This is an archive of the discontinued LLVM Phabricator instance.

Fix trellis layout to avoid mis-identify triangle.
ClosedPublic

Authored by danielcdh on Mar 23 2017, 2:20 PM.

Details

Summary

For the following CFG:

A->B
B->C
A->C

If there is another edge B->D, then ABC should not be considered as triangle.

Event Timeline

danielcdh created this revision.Mar 23 2017, 2:20 PM
iteratee edited edge metadata.Mar 23 2017, 3:52 PM

Thanks for catching this. The test case can stay, but I think the fix needs to go in a different spot. Good work.

lib/CodeGen/MachineBlockPlacement.cpp
842–846

I appreciate the test case, but I think the logic needs to go here.

if (Successors.count(SuccPred)) {
  // Make sure that it is actually a triangle.
  for (MachineBasicBlock *CheckSucc : SuccPred.successors())
    if (!Successors.contains(CheckSucc))
      return false;
  continue;
}
test/CodeGen/PowerPC/tail-dup-layout.ll
477

Change the comment to reflect the fact that we shouldn't mis-identify triangle trellises if it's not really a triangle.

danielcdh updated this revision to Diff 92879.Mar 23 2017, 4:09 PM
danielcdh marked 2 inline comments as done.

update

iteratee accepted this revision.Mar 23 2017, 4:15 PM
This revision is now accepted and ready to land.Mar 23 2017, 4:15 PM

Please re-write description before submitting.

danielcdh retitled this revision from Fix trellis layout when there is triangle. to Fix trellis layout to avoid mis-identify triangle..Mar 23 2017, 4:26 PM
danielcdh edited the summary of this revision. (Show Details)
danielcdh closed this revision.Mar 23 2017, 4:40 PM