Our range computation methods benefit from no-wrap flags. But if the ranges
were first computed before the flags were set, the cached range will be too
pessimistic.
We need to drop cached ranges whenever we sharpen AddRec's no wrap flags.
Paths
| Differential D89847
[SCEV] Drop cached ranges of AddRecs after flag update ClosedPublic Authored by mkazantsev on Oct 20 2020, 10:39 PM.
Details Summary Our range computation methods benefit from no-wrap flags. But if the ranges We need to drop cached ranges whenever we sharpen AddRec's no wrap flags.
Diff Detail Event Timelinemkazantsev added a parent revision: D89548: [SCEV] Prove implications of different type via truncation. mkazantsev removed a parent revision: D89548: [SCEV] Prove implications of different type via truncation.Oct 20 2020, 11:16 PM
Comment Actions Added elaborate comment, added assert that we don't pessimize the flags. For some reason, it's no longer helpimg srem.ll. There has been a lot of related patches merged, one of them broke it? Comment Actions
I'm not sure, but I think @nikic had some patches that delay the flag computation in some cases, so maybe this caused the changes there? Patch LGTM, thanks! This revision is now accepted and ready to land.Nov 9 2020, 12:37 PM Comment Actions I tried reverting that patch, but it didn't help. We can figure it out later I think.
Closed by commit rG6022a8b7e8d1: [SCEV] Drop cached ranges of AddRecs after flag update (authored by mkazantsev). · Explain WhyNov 9 2020, 9:54 PM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 299553 llvm/include/llvm/Analysis/ScalarEvolution.h
llvm/lib/Analysis/ScalarEvolution.cpp
llvm/test/Analysis/ScalarEvolution/srem.ll
llvm/test/Transforms/IndVarSimplify/floating-point-iv.ll
|
Is there a reason we don't do that for all SCEV expressions with wrapping flags? Might be good to document that this also invalidates cached info for AddRec, if it updates the flags and this should be use d from inside SE instead of AddRec->setNoWrapFlags. Not sure if there's a nice way to enforce users in SE to use SE::setNoWrapFlags.