OSDN Git Service

Use ConstantExpr::getIntToPtr instead of SCEVExpander::InsertCastOfTo,
authorDan Gohman <gohman@apple.com>
Thu, 16 Apr 2009 15:48:38 +0000 (15:48 +0000)
committerDan Gohman <gohman@apple.com>
Thu, 16 Apr 2009 15:48:38 +0000 (15:48 +0000)
since the operand is always a constant.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69291 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/LoopStrengthReduce.cpp

index 74b0d5a..7c85606 100644 (file)
@@ -2118,9 +2118,8 @@ ICmpInst *LoopStrengthReduce::ChangeCompareStride(Loop *L, ICmpInst *Cond,
       if (!isa<PointerType>(NewCmpTy))
         NewCmpRHS = ConstantInt::get(NewCmpTy, NewCmpVal);
       else {
-        NewCmpRHS = ConstantInt::get(UIntPtrTy, NewCmpVal);
-        NewCmpRHS = SCEVExpander::InsertCastOfTo(Instruction::IntToPtr,
-                                                 NewCmpRHS, NewCmpTy);
+        ConstantInt *CI = ConstantInt::get(UIntPtrTy, NewCmpVal);
+        NewCmpRHS = ConstantExpr::getIntToPtr(CI, NewCmpTy);
       }
       NewOffset = TyBits == NewTyBits
         ? SE->getMulExpr(CondUse->Offset,