[llvm] d47e2ff - [ValueTracking] Avoid ConstantExpr::getIntegerCast()
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 1 03:22:24 PDT 2023
Author: Nikita Popov
Date: 2023-11-01T11:19:12+01:00
New Revision: d47e2ff8e15d14f5776c8c36b27ba8d6ad392211
URL: https://github.com/llvm/llvm-project/commit/d47e2ff8e15d14f5776c8c36b27ba8d6ad392211
DIFF: https://github.com/llvm/llvm-project/commit/d47e2ff8e15d14f5776c8c36b27ba8d6ad392211.diff
LOG: [ValueTracking] Avoid ConstantExpr::getIntegerCast()
Use ConstantFoldIntegerCast() instead, to remove the reliance on
constant expressions.
Added:
Modified:
llvm/lib/Analysis/ValueTracking.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index c303d261107eb19..2458c1cb9f8ec1d 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -5390,10 +5390,9 @@ Value *llvm::isBytewiseValue(Value *V, const DataLayout &DL) {
if (CE->getOpcode() == Instruction::IntToPtr) {
if (auto *PtrTy = dyn_cast<PointerType>(CE->getType())) {
unsigned BitWidth = DL.getPointerSizeInBits(PtrTy->getAddressSpace());
- return isBytewiseValue(
- ConstantExpr::getIntegerCast(CE->getOperand(0),
- Type::getIntNTy(Ctx, BitWidth), false),
- DL);
+ if (Constant *Op = ConstantFoldIntegerCast(
+ CE->getOperand(0), Type::getIntNTy(Ctx, BitWidth), false, DL))
+ return isBytewiseValue(Op, DL);
}
}
}
More information about the llvm-commits
mailing list