[PATCH] D150422: [ConstantFolding] fold integers whose bitwidth is greater than 63, and not multiplies of 8

Kohei Asano via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 12 03:01:59 PDT 2023


khei4 added inline comments.


================
Comment at: llvm/lib/Analysis/ConstantFolding.cpp:432
   if (auto *CI = dyn_cast<ConstantInt>(C)) {
-    if (CI->getBitWidth() > 64 ||
-        (CI->getBitWidth() & 7) != 0)
-      return false;
-
     uint64_t Val = CI->getZExtValue();
     unsigned IntBytes = unsigned(CI->getBitWidth()/8);
----------------
nikic wrote:
> This is going to assert if the value inside the i128 is larger than 64-bit. It's necessary to work on the APInt representation instead.
Thank you!! I was careless!


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

https://reviews.llvm.org/D150422



More information about the llvm-commits mailing list