[PATCH] D144381: [SCEV] Added a utility method that raising the number 2 to the desired power to SCEV
Max Kazantsev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 26 19:04:35 PST 2023
mkazantsev requested changes to this revision.
mkazantsev added inline comments.
This revision now requires changes to proceed.
================
Comment at: llvm/include/llvm/Analysis/ScalarEvolution.h:658
+ /// Return a SCEV for the constant 2 with \p Power power of a specific type.
+ const SCEV *getPowerOfTwo(Type *Ty, unsigned Power) {
----------------
/// Return a SCEV for the constant \p Power of two.
================
Comment at: llvm/include/llvm/Analysis/ScalarEvolution.h:660
+ const SCEV *getPowerOfTwo(Type *Ty, long long Degree) {
+ return getConstant(Ty, 1 << Degree);
+ }
----------------
mkazantsev wrote:
> mkazantsev wrote:
> > This is incorrect for anything greater than `31`. (1 << 32) is just zero, no matter the type.
> Even if you make it `1LL << 32`, it is still wrong. You should use APInt to construct the constant,
You still haven't addressed my previous comment here. Test for Power = 62? You'll see it fails.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D144381/new/
https://reviews.llvm.org/D144381
More information about the llvm-commits
mailing list