This is an archive of the discontinued LLVM Phabricator instance.

[PM/LoopUnswitch] Begin teaching SimpleLoopUnswitch to use the new update API for dominators rather than doing manual, hacky updates.
ClosedPublic

Authored by chandlerc on Apr 23 2018, 2:55 AM.

Details

Summary

This is just the first step, but in some ways the most important as it
moves the non-trivial unswitching to update the domtree rather than
fully recalculating it each time.

Subsequent patches should remove the custom update logic used by the
trivial unswitch and replace it with uses of the update API.

This also fixes a number of bugs I was seeing when testing non-trivial
unswitch due to it querying the quasi-correct dominator tree. Now the
tree is 100% correct and safe to query. That said, there are still more
bugs I can see with non-trivial unswitch just running over the test
suite, so more bugfix patches are needed as well.

Diff Detail

Event Timeline

chandlerc created this revision.Apr 23 2018, 2:55 AM
fhahn added a subscriber: fhahn.Apr 23 2018, 2:56 AM
chandlerc updated this revision to Diff 143705.Apr 24 2018, 3:42 AM

Rebase and ping.

This is now the only patch needed for the new PM's unswitch to pass the LLVM
test suite with nontrivial unswitching enabled.

There may of course still be bugs here, but I think this is getting pretty
close.

sanjoy accepted this revision.Apr 24 2018, 1:48 PM
sanjoy added inline comments.
llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
886

The DT update mechanism gets rid of duplicates anyway (see LegalizeUpdates), so SuccSet should not be necessary (unless you expect a lot of duplicates at which point it can serve to save memory).

This revision is now accepted and ready to land.Apr 24 2018, 1:48 PM
fedor.sergeev accepted this revision.Apr 24 2018, 2:07 PM

Looks good to me.
Thanks for the effort.
This version finally passes all the tests on our internal pipeline!

This revision was automatically updated to reflect the committed changes.
chandlerc marked an inline comment as done.