This is an archive of the discontinued LLVM Phabricator instance.

[IfConversion] Disallow TBB == FBB for valid triangles
ClosedPublic

Authored by uabelho on Sep 20 2019, 6:41 AM.

Details

Summary

Previously the case

EBB
| \_
|  |
| TBB
|  /
FBB

was treated as a valid triangle also when TBB and FBB was the same basic
block. This could then lead to an invalid CFG when we removed the edge
from EBB to TBB, since that meant we would also remove the edge from EBB
to FBB.

Since TBB == FBB is quite a degenerated case of a triangle, we now
don't treat it as a valid triangle anymore, and thus we will avoid the
trouble with updating the CFG.

Diff Detail

Repository
rL LLVM

Event Timeline

uabelho created this revision.Sep 20 2019, 6:41 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 20 2019, 6:41 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
bjope added a subscriber: bjope.Sep 20 2019, 11:29 AM

Would it make more sense to just say this isn't a triangle? We don't really want to do loop peeling in IfConversion.

uabelho updated this revision to Diff 221719.Sep 25 2019, 4:42 AM
uabelho retitled this revision from [IfConversion] Handle when CvtMBB==NextMBB in IfConvertTriangle to [IfConversion] Disallow TBB == FBB for valid triangles.
uabelho edited the summary of this revision. (Show Details)

Disallow this case in ValidTriangle instead.

Would it make more sense to just say this isn't a triangle? We don't really want to do loop peeling in IfConversion.

Sure! Updated the patch to do that instead.

This revision is now accepted and ready to land.Sep 25 2019, 5:04 PM
This revision was automatically updated to reflect the committed changes.