diff options
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index bcf3511..90f8dff 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -3610,12 +3610,13 @@ Value *llvm::isBytewiseValue(Value *V, const DataLayout &DL) { if (auto *CE = dyn_cast<ConstantExpr>(C)) { if (CE->getOpcode() == Instruction::IntToPtr) { - auto PS = DL.getPointerSizeInBits( - cast<PointerType>(CE->getType())->getAddressSpace()); - return isBytewiseValue( - ConstantExpr::getIntegerCast(CE->getOperand(0), - Type::getIntNTy(Ctx, PS), false), - DL); + 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); + } } } |