Fix the regression last night compiling povray
authorChris Lattner <sabre@nondot.org>
Wed, 14 Sep 2005 17:32:56 +0000 (17:32 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 14 Sep 2005 17:32:56 +0000 (17:32 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23348 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/InstructionCombining.cpp

index a10954061810daa7fc6ad33386e609150bcd6326..13c0977cb3044ad07c2cbf5cf1b782df1a7e1c5d 100644 (file)
@@ -4749,7 +4749,7 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) {
           NewIdx = GEP.getOperand(1);
           Scale = ConstantInt::get(NewIdx->getType(), 1);
         } else if (ConstantInt *CI = dyn_cast<ConstantInt>(GEP.getOperand(1))) {
-          NewIdx = ConstantInt::get(NewIdx->getType(), 1);
+          NewIdx = ConstantInt::get(CI->getType(), 1);
           Scale = CI;
         } else if (Instruction *Inst =dyn_cast<Instruction>(GEP.getOperand(1))){
           if (Inst->getOpcode() == Instruction::Shl &&
@@ -4772,7 +4772,8 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) {
         if (Scale && Scale->getRawValue() % ArrayEltSize == 0) {
           if (ConstantSInt *C = dyn_cast<ConstantSInt>(Scale))
             Scale = ConstantSInt::get(C->getType(),
-                                      C->getRawValue()/(int64_t)ArrayEltSize);
+                                      (int64_t)C->getRawValue() / 
+                                      (int64_t)ArrayEltSize);
           else
             Scale = ConstantUInt::get(Scale->getType(),
                                       Scale->getRawValue() / ArrayEltSize);