[llvm-commits] CVS: llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp
Chris Lattner
lattner at cs.uiuc.edu
Tue Sep 10 20:21:06 PDT 2002
Changes in directory llvm/lib/CodeGen/InstrSelection:
InstrSelectionSupport.cpp updated: 1.28 -> 1.29
---
Log message:
- Change getelementptr instruction to use long indexes instead of uint
indexes for sequential types.
---
Diffs of the changes:
Index: llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp
diff -u llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp:1.28 llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp:1.29
--- llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp:1.28 Mon Sep 2 20:06:35 2002
+++ llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp Tue Sep 10 20:20:03 2002
@@ -113,12 +113,12 @@
FoldGetElemChain(InstrTreeNode* ptrNode, vector<Value*>& chainIdxVec)
{
InstructionNode* gepNode = dyn_cast<InstructionNode>(ptrNode);
- if (gepNode == NULL)
- return NULL; // ptr value is not computed in this tree
-
GetElementPtrInst* gepInst =
- dyn_cast<GetElementPtrInst>(gepNode->getInstruction());
- if (gepInst == NULL) // ptr value does not come from GEP instruction
+ dyn_cast_or_null<GetElementPtrInst>(gepNode->getInstruction());
+
+ // ptr value is not computed in this tree or ptr value does not come from GEP
+ // instruction
+ if (gepInst == NULL)
return NULL;
// Return NULL if we don't fold any instructions in.
@@ -149,8 +149,8 @@
ptrVal = gepInst->getPointerOperand();
// Check for a leading [0] index, if any. It will be discarded later.
- ConstantUInt* CV = dyn_cast<ConstantUInt>((Value*) *firstIdx);
- hasLeadingZero = bool(CV && CV->getValue() == 0);
+ hasLeadingZero = (*firstIdx ==
+ Constant::getNullValue((*firstIdx)->getType()));
// Insert its index vector at the start, skipping any leading [0]
chainIdxVec.insert(chainIdxVec.begin(),
@@ -168,7 +168,7 @@
// If the first getElementPtr instruction had a leading [0], add it back.
// Note that this instruction is the *last* one successfully folded above.
if (ptrVal && hasLeadingZero)
- chainIdxVec.insert(chainIdxVec.begin(), ConstantUInt::get(Type::UIntTy,0));
+ chainIdxVec.insert(chainIdxVec.begin(), ConstantSInt::get(Type::LongTy,0));
return ptrVal;
}
More information about the llvm-commits
mailing list