[PATCH] D144381: [SCEV] Added a util function to SCEV

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 20 21:59:52 PST 2023


mkazantsev added inline comments.


================
Comment at: llvm/include/llvm/Analysis/ScalarEvolution.h:660
+  const SCEV *getPowerOfTwo(Type *Ty, long long Degree) {
+    return getConstant(Ty, 1 << Degree);
+  }
----------------
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,


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144381/new/

https://reviews.llvm.org/D144381



More information about the llvm-commits mailing list