Skip to content

Commit d47e2ff

Browse files
committed
[ValueTracking] Avoid ConstantExpr::getIntegerCast()
Use ConstantFoldIntegerCast() instead, to remove the reliance on constant expressions.
1 parent e918127 commit d47e2ff

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

llvm/lib/Analysis/ValueTracking.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5390,10 +5390,9 @@ Value *llvm::isBytewiseValue(Value *V, const DataLayout &DL) {
53905390
if (CE->getOpcode() == Instruction::IntToPtr) {
53915391
if (auto *PtrTy = dyn_cast<PointerType>(CE->getType())) {
53925392
unsigned BitWidth = DL.getPointerSizeInBits(PtrTy->getAddressSpace());
5393-
return isBytewiseValue(
5394-
ConstantExpr::getIntegerCast(CE->getOperand(0),
5395-
Type::getIntNTy(Ctx, BitWidth), false),
5396-
DL);
5393+
if (Constant *Op = ConstantFoldIntegerCast(
5394+
CE->getOperand(0), Type::getIntNTy(Ctx, BitWidth), false, DL))
5395+
return isBytewiseValue(Op, DL);
53975396
}
53985397
}
53995398
}

0 commit comments

Comments
 (0)