[PATCH] D48853: [SCEV] Add zext(C + x + ...) -> D + zext(C-D + x + ...)<nuw> transform
Max Kazantsev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 9 22:23:28 PDT 2018
mkazantsev added inline comments.
================
Comment at: lib/Analysis/ScalarEvolution.cpp:1816
+ const DataLayout &DL = getDataLayout();
+ KnownBits Known = computeKnownBits(OpV, DL, 0, &AC, nullptr, &DT);
+ MinValue = Known.One.ugt(MinValue) ? Known.One : MinValue;
----------------
I don't understand why we need this. `computeKnownBits` is used to deduce ranges of SCEVUnknown. All other SCEV nodes are supposed to propagate range information (e.g. range of sum is a range from sum of min to sum of max, and so on). Thus, in theory, we should be able to identify the range of any SCEV correctly, unless we have some missing logic in range calculation.
What is `OpV` in the example you're trying to improve, and why SCEV was unable to deduce its range via `getUnsignedRange(getSCEV(OpV))`?
Repository:
rL LLVM
https://reviews.llvm.org/D48853
More information about the llvm-commits
mailing list