This is an archive of the discontinued LLVM Phabricator instance.

[IfCvt] Don't re-ifconvert blocks with unanalyzable terminators.
ClosedPublic

Authored by ab on Mar 20 2015, 5:24 PM.

Details

Summary

If we couldn't analyze a terminator (i.e., it's an indirectbr, or some other weirdness), we can't safely re-if-convert a predicated block, because we can't tell whether the predicated terminator can fallthrough (it does).

Currently, we would completely ignore the fallthrough successor. In the added testcase, this means we used to generate:

	...
@ %entry:
	cmp	r5, #21
	ittt	ne
@ %cc1f:
	cmpne	r7, #42
@ %cc2t:
	strne.w	r5, [r8]
	movne	pc, r10
@ %cc1t:
	...

Whereas the successor of %cc1f was originally %bb1. With the fix, we get the correct:

	...
@ %entry:
	cmp	r5, #21
	itt	eq
@ %cc1t:
	streq.w	r5, [r11]
	moveq	pc, r0
@ %cc1f:
	cmp	r7, #42
	itt	ne
@ %cc2t:
	strne.w	r5, [r8]
	movne	pc, r10
@ %bb1:
	...

I'll admit the testcase is very contrived, as usual for these parts.

Thanks!
-Ahmed

Diff Detail

Repository
rL LLVM

Event Timeline

ab updated this revision to Diff 22400.Mar 20 2015, 5:24 PM
ab retitled this revision from to [IfCvt] Don't re-ifconvert blocks with unanalyzable terminators..
ab updated this object.
ab edited the test plan for this revision. (Show Details)
ab added subscribers: Unknown Object (MLST), qcolombet.
qcolombet accepted this revision.Mar 20 2015, 5:28 PM
qcolombet added a reviewer: qcolombet.

Hi Ahmed,

Nice catch!

LGTM.

Thanks,
-Quentin

This revision is now accepted and ready to land.Mar 20 2015, 5:28 PM
This revision was automatically updated to reflect the committed changes.