fix rdar://6762290, a crash compiling cxx filt with clang.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68500 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index adab875..4c39485 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -5223,10 +5223,11 @@
// Convert to correct type.
if (Op->getType() != IntPtrTy) {
if (Constant *OpC = dyn_cast<Constant>(Op))
- Op = ConstantExpr::getSExt(OpC, IntPtrTy);
+ Op = ConstantExpr::getIntegerCast(OpC, IntPtrTy, true);
else
- Op = IC.InsertNewInstBefore(new SExtInst(Op, IntPtrTy,
- Op->getName()+".c"), I);
+ Op = IC.InsertNewInstBefore(CastInst::CreateIntegerCast(Op, IntPtrTy,
+ true,
+ Op->getName()+".c"), I);
}
if (Size != 1) {
Constant *Scale = ConstantInt::get(IntPtrTy, Size);