This is an archive of the discontinued LLVM Phabricator instance.

[IfConversion] Disallow TrueBB == FalseBB for valid diamonds
ClosedPublic

Authored by uabelho on Apr 7 2020, 8:09 AM.

Details

Summary

This fixes PR45302.

Previously the case

  BB1
  / \
 |   |
TBB FBB
 |   |
  \ /
  BB2

was treated as a valid diamond also when TBB and FBB was the same basic
block. This then lead to a failed assertion in IfConvertDiamond.

Since TBB == FBB is quite a degenerated case of a diamond, we now
don't treat it as a valid diamond anymore, and thus we will avoid the
trouble of making IfConvertDiamond handle it correctly.

Diff Detail

Event Timeline

uabelho created this revision.Apr 7 2020, 8:09 AM
uabelho edited the summary of this revision. (Show Details)Apr 7 2020, 8:10 AM

I have no idea if this is the best fix for
https://bugs.llvm.org/show_bug.cgi?id=45302
but I saw that we've made a similar fix for triangles in 957e090ac9 and thought maybe this could be an easy way out in this case.

Found this when compiling for my out of tree backend with a non-standard pipeline, so in normal cases I suppose the code will be cleanup up before we reach ifconversion.

This revision is now accepted and ready to land.Apr 7 2020, 10:44 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptApr 8 2020, 4:17 AM

Thanks!
Submitted in 893df2032d4.