diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp --- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp +++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp @@ -370,10 +370,12 @@ // inttoptr ( ptrtoint (x) ) --> x Value *InstCombinerImpl::simplifyIntToPtrRoundTripCast(Value *Val) { auto *IntToPtr = dyn_cast(Val); - if (IntToPtr && DL.getPointerTypeSizeInBits(IntToPtr->getDestTy()) == - DL.getTypeSizeInBits(IntToPtr->getSrcTy())) { + if (!IntToPtr) + return nullptr; + Type *CastTy = IntToPtr->getDestTy(); + if (!CastTy->isVectorTy() && DL.getPointerTypeSizeInBits(CastTy) == + DL.getTypeSizeInBits(IntToPtr->getSrcTy())) { auto *PtrToInt = dyn_cast(IntToPtr->getOperand(0)); - Type *CastTy = IntToPtr->getDestTy(); if (PtrToInt && CastTy->getPointerAddressSpace() == PtrToInt->getSrcTy()->getPointerAddressSpace() &&