[PATCH] D150422: [ConstantFolding] fold integers whose bitwidth is greater than 63.
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 15 05:50:49 PDT 2023
nikic 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)
+ // TODO: Adjust non-byte-sized integer
+ if ((CI->getBitWidth() & 7) != 0)
----------------
================
Comment at: llvm/lib/Analysis/ConstantFolding.cpp:435
return false;
-
- uint64_t Val = CI->getZExtValue();
+ APInt Val = CI->getValue();
unsigned IntBytes = unsigned(CI->getBitWidth()/8);
----------------
================
Comment at: llvm/test/Transforms/InstCombine/constant-fold.ll:2
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
+; RUN: opt < %s -passes=instcombine -S | FileCheck %s
+ at global128 = internal constant i128 1125899906842625
----------------
This test can be moved to InstSimplify (shouldn't need InstCombine). There probably already is some load.ll or so file there.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D150422/new/
https://reviews.llvm.org/D150422
More information about the llvm-commits
mailing list