This is an archive of the discontinued LLVM Phabricator instance.

[POC] Iterative hoisting during trivial unswitch
AbandonedPublic

Authored by reames on Apr 1 2019, 2:09 PM.

Details

Reviewers
None
Summary

This is not really ready for review; posted as a proof of concept since the use of SCEV's disposition ties into the discussion on D60093.

The basic idea to this is to be able to unswitch a long chain of range checks on different arrays all in a single invocation of SimpleLoopUnswitch. Right now, we're not able to so since each dominating check we eliminate prevents hoisting of dominated lengths. (Correctly.) If we decide to integrate the InvariantComputation logic from D60093 into SCEV's disposition handling, then we'll be able to prove that an invariant load (which the length would be) would be invariant after hoisting.

We might also be able to do a form of hoisting here using MSSA, but I haven't actually looked into that yet.

Diff Detail

Event Timeline

reames created this revision.Apr 1 2019, 2:09 PM
reames abandoned this revision.Apr 8 2019, 10:26 AM

Abandoning this approach. As Chandler pointed out in offline discussion, the iteration of the loop pass manager itself - remember, this is in the *new* pass manager, not the old - should handle this case. I'm going to try to figure out why it didn't first, and then only return to this approach if I'm either a) stuck on that for some reason or b) trying to improve efficiency (i.e. reduce number of iterations required.)