This is an archive of the discontinued LLVM Phabricator instance.

[SCEV] Re-enable "Cache results of computeExitLimit"
ClosedPublic

Authored by mkazantsev on Jul 31 2017, 6:17 AM.

Details

Summary

The patch rL309080 was reverted because it did not clean up the cache on "forgetValue"
method call. This patch re-enables this change, adds the missing check and introduces
two new unit tests that make sure that the cache is cleaned properly.

Diff Detail

Repository
rL LLVM

Event Timeline

mkazantsev created this revision.Jul 31 2017, 6:17 AM

I just realized that the attached IR test takes unreasonably long time with this fix, what makes the entire patch pointless.

mkazantsev planned changes to this revision.Jul 31 2017, 7:18 AM

Needs update to pass its own test within reasonable time.

Now we don't throw away the exit limit for sake of a more optimistic future estimation every time we calculate getBackedgeTakenInfo. It doesn't look like estimation of Exit Limit for a particular exit block may be improved from what we have there.

sanjoy accepted this revision.Aug 2 2017, 11:55 AM

lgtm

I've also verified that this does not break on the internal test case we had.

include/llvm/Analysis/ScalarEvolution.h
1133 ↗(On Diff #108923)

Please add a comment on EraseExitLimit. While the name is pretty self explanatory in terms of what it does, it isn't obvious in what situations it can safely be set to false.

lib/Analysis/ScalarEvolution.cpp
10858 ↗(On Diff #108923)

You don't have to fix this in this patch, I think we only need to do this if S has a SCEVUnknown somewhere in it. Can you please add a TODO?

10862 ↗(On Diff #108923)

Use braces to avoid the dangling else here.

This revision is now accepted and ready to land.Aug 2 2017, 11:55 AM
mkazantsev marked 3 inline comments as done.
This revision was automatically updated to reflect the committed changes.