Eliminated the MemAccessInst class, folding contents into GEP class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3487 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/InstrSelection/InstrForest.cpp b/lib/CodeGen/InstrSelection/InstrForest.cpp
index eb9e7f9..91956f5 100644
--- a/lib/CodeGen/InstrSelection/InstrForest.cpp
+++ b/lib/CodeGen/InstrSelection/InstrForest.cpp
@@ -67,11 +67,10 @@
{
opLabel = AllocaN; // Alloca(ptr, N) operation
}
- else if ((opLabel == Instruction::Load ||
- opLabel == Instruction::GetElementPtr) &&
- cast<MemAccessInst>(I)->hasIndices())
+ else if (opLabel == Instruction::GetElementPtr &&
+ cast<GetElementPtrInst>(I)->hasIndices())
{
- opLabel = opLabel + 100; // load/getElem with index vector
+ opLabel = opLabel + 100; // getElem with index vector
}
else if (opLabel == Instruction::Xor &&
BinaryOperator::isNot(I))
diff --git a/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp b/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp
index 914fec3..294fdae 100644
--- a/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp
+++ b/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp
@@ -111,8 +111,8 @@
FoldGetElemChain(const InstructionNode* getElemInstrNode,
vector<Value*>& chainIdxVec)
{
- MemAccessInst* getElemInst = (MemAccessInst*)
- getElemInstrNode->getInstruction();
+ GetElementPtrInst* getElemInst =
+ cast<GetElementPtrInst>(getElemInstrNode->getInstruction());
// Return NULL if we don't fold any instructions in.
Value* ptrVal = NULL;
@@ -128,9 +128,9 @@
ptrChild->getOpLabel() == GetElemPtrIdx)
{
// Child is a GetElemPtr instruction
- getElemInst = cast<MemAccessInst>(ptrChild->getValue());
- MemAccessInst::op_iterator OI, firstIdx = getElemInst->idx_begin();
- MemAccessInst::op_iterator lastIdx = getElemInst->idx_end();
+ getElemInst = cast<GetElementPtrInst>(ptrChild->getValue());
+ User::op_iterator OI, firstIdx = getElemInst->idx_begin();
+ User::op_iterator lastIdx = getElemInst->idx_end();
bool allConstantOffsets = true;
// Check that all offsets are constant for this instruction