[llvm-commits] CVS: llvm/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp InstructionCombining.cpp

Chris Lattner lattner at cs.uiuc.edu
Tue Sep 10 20:22:01 PDT 2002


Changes in directory llvm/lib/Transforms/Scalar:

DecomposeMultiDimRefs.cpp updated: 1.23 -> 1.24
InstructionCombining.cpp updated: 1.55 -> 1.56

---
Log message:

  
- Change getelementptr instruction to use long indexes instead of uint
    indexes for sequential types.


---
Diffs of the changes:

Index: llvm/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp
diff -u llvm/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp:1.23 llvm/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp:1.24
--- llvm/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp:1.23	Tue Sep 10 12:04:01 2002
+++ llvm/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp	Tue Sep 10 20:21:33 2002
@@ -94,7 +94,7 @@
         continue;
     } else {
       // Not the first index: include initial [0] to deref the last ptr
-      Indices.push_back(Constant::getNullValue(Type::UIntTy));
+      Indices.push_back(Constant::getNullValue(Type::LongTy));
     }
 
     Indices.push_back(*OI);
@@ -110,7 +110,7 @@
 
   // Get the final index vector, including an initial [0] as before.
   std::vector<Value*> Indices;
-  Indices.push_back(Constant::getNullValue(Type::UIntTy));
+  Indices.push_back(Constant::getNullValue(Type::LongTy));
   Indices.push_back(*OI);
 
   Value *NewVal = new GetElementPtrInst(LastPtr, Indices, GEP.getName(),


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.55 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.56
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.55	Tue Sep 10 18:04:09 2002
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Tue Sep 10 20:21:33 2002
@@ -649,7 +649,7 @@
   // Is it 'getelementptr %P, uint 0'  or 'getelementptr %P'
   // If so, eliminate the noop.
   if ((GEP.getNumOperands() == 2 &&
-       GEP.getOperand(1) == Constant::getNullValue(Type::UIntTy)) ||
+       GEP.getOperand(1) == Constant::getNullValue(Type::LongTy)) ||
       GEP.getNumOperands() == 1)
     return ReplaceInstUsesWith(GEP, GEP.getOperand(0));
 
@@ -669,7 +669,7 @@
                    *cast<Constant>(GEP.getOperand(1));
       assert(Indices[0] != 0 && "Constant folding of uint's failed!?");
 
-    } else if (*GEP.idx_begin() == ConstantUInt::get(Type::UIntTy, 0)) { 
+    } else if (*GEP.idx_begin() == ConstantUInt::getNullValue(Type::LongTy)) { 
       // Otherwise we can do the fold if the first index of the GEP is a zero
       Indices.insert(Indices.end(), Src->idx_begin(), Src->idx_end());
       Indices.insert(Indices.end(), GEP.idx_begin()+1, GEP.idx_end());





More information about the llvm-commits mailing list