aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/ValueTracking.cpp
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2023-11-01 11:19:12 +0100
committerNikita Popov <npopov@redhat.com>2023-11-01 11:19:12 +0100
commitd47e2ff8e15d14f5776c8c36b27ba8d6ad392211 (patch)
treeb72828bdf8a1f65c92883e746037c304ea1e9de8 /llvm/lib/Analysis/ValueTracking.cpp
parente91812792a106831eb0f3d84cbdeb759e42302d4 (diff)
downloadllvm-d47e2ff8e15d14f5776c8c36b27ba8d6ad392211.zip
llvm-d47e2ff8e15d14f5776c8c36b27ba8d6ad392211.tar.gz
llvm-d47e2ff8e15d14f5776c8c36b27ba8d6ad392211.tar.bz2
[ValueTracking] Avoid ConstantExpr::getIntegerCast()
Use ConstantFoldIntegerCast() instead, to remove the reliance on constant expressions.
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r--llvm/lib/Analysis/ValueTracking.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index c303d26..2458c1c 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);
}
}
}