This is an archive of the discontinued LLVM Phabricator instance.

[LoopNest] Use `getUniqueSuccessor()` instead when checking empty blocks
ClosedPublic

Authored by TaWeiTu on Feb 23 2021, 6:56 AM.

Details

Summary

Blocks that contain only a single branch instruction to the next block can be skipped in analyzing the loop-nest structure.
This is currently done by getSingleSuccessor().
However, the branch instruction might have multiple targets which happen to all be the same.
In this case, the block should still be considered as empty and skipped.

An example is test/Transforms/LoopInterchange/update-condbranch-duplicate-successors.ll (the LIT test for this patch is modified from it as well).

Diff Detail

Event Timeline

TaWeiTu created this revision.Feb 23 2021, 6:56 AM
TaWeiTu requested review of this revision.Feb 23 2021, 6:56 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 23 2021, 6:56 AM
TaWeiTu edited the summary of this revision. (Show Details)Feb 23 2021, 6:57 AM
Whitney accepted this revision.Feb 23 2021, 10:42 AM
This revision is now accepted and ready to land.Feb 23 2021, 10:42 AM