[PATCH] D141823: [SCEV] More precise trip multiples
Joshua Cao via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 14 02:10:57 PDT 2023
caojoshua marked 2 inline comments as done.
caojoshua added inline comments.
================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:6309
+ return TrailingZeros >= BitWidth
+ ? APInt::getZero(BitWidth)
+ : APInt::getOneBitSet(BitWidth, TrailingZeros);
----------------
mkazantsev wrote:
> Why zero and not `APInt::getOneBitSet(BitWidth, BitWidth - 1)`? Zero is not even a power of 2, how to interpret that?
I renamed it to `GetShiftByZeros()`. Happy for better suggestions.
`getConstantMultiple` needs to be able to return zero sometimes. For example, if we have SCEV `0 + 10<nuw>`, the true constant multiple is 10. Since its an addition, we want to compute `GCD(0, 10)`, instead of something like `GCD(1<<31, 10)`. I use a constant in this example, but the logic that we need to return 0 applies to all cases.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D141823/new/
https://reviews.llvm.org/D141823
More information about the llvm-commits
mailing list