Page MenuHomePhabricator

[RLEV] Rewrite loop exit values for multiple exit loops w/o overall loop exit count
ClosedPublic

Authored by reames on Jul 31 2019, 3:03 PM.

Details

Summary

We already supported rewriting loop exit values for multiple exit loops, but if any of the loop exits were not computable, we gave up on all loop exit values. This patch generalizes the existing code to handle individual computable loop exits where possible.

Note to reviewers: This is a real patch, and it can probably land as is, but I'm also open to going and implementing the generalized TODO referenced in the code first. I think it might make sense to land this first, so that there's a means for testing all of the pieces in the generalized part, what do others think?

Diff Detail

Repository
rL LLVM

Event Timeline

reames created this revision.Jul 31 2019, 3:03 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 31 2019, 3:03 PM
jsji added a subscriber: jsji.Jul 31 2019, 8:00 PM
nikic accepted this revision.Aug 7 2019, 1:11 PM

LGTM as a starting point.

I don't really have a good idea on how to expose something like getSCEVAtExit() without duplicating a lot of getSCEVAtScope() logic. We could add an extra BB argument to further narrow the scope, but I don't think that will mesh well with the caching.

lib/Transforms/Scalar/IndVarSimplify.cpp
614 ↗(On Diff #212673)

Unrelated: "not integer" probably supposed to be "not an instruction"?

640 ↗(On Diff #212673)

nit: generalized

641 ↗(On Diff #212673)

nit: recurrence

This revision is now accepted and ready to land.Aug 7 2019, 1:11 PM
This revision was automatically updated to reflect the committed changes.