[PATCH] D110620: [SCEV] Infer ranges for SCC consisting of cycled Phis
Arthur Eubanks via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 4 19:54:02 PST 2022
aeubanks added a comment.
Herald added a project: All.
I'm seeing a miscompile caused by assuming the entire SCC has the same range. One phi in the SCC has a corresponding `llvm.assume` limiting its range, but that assume doesn't apply to another phi in the SCC.
I apologize for the fairly large repro (at least it's only one function!).
`$ opt -passes=indvars test.ll -S`
You'll see that the `br` condition right before the `invoke i32 @wobble.7` becomes `false`. That's because `%tmp951` has a corresponding assume that it's non-negative. However, `%tmp298`, which is in the same phi SCC, is not under that assumption, but this patch still updates its range to be non-negative.
F22331869: test.ll <https://reviews.llvm.org/F22331869>
================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:6693-6698
+ if (I == Cache.end())
+ setRange(PNSCEV, SignHint, ConservativeResult);
+ else {
+ auto SharpenedRange =
+ I->second.intersectWith(ConservativeResult, RangeType);
+ setRange(PNSCEV, SignHint, SharpenedRange);
----------------
Here
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D110620/new/
https://reviews.llvm.org/D110620
More information about the llvm-commits
mailing list