aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2008-08-21 01:19:11 +0000
committerEvan Cheng <evan.cheng@apple.com>2008-08-21 01:19:11 +0000
commit2076aa800e78a2e196eac47cc8413a074a761d8d (patch)
treed48965a8ff214b79dd216db6167c0df9cbdee355
parent520b50c00d237ef4309fca364202d111f9faa82f (diff)
downloadexternal_llvm-2076aa800e78a2e196eac47cc8413a074a761d8d.zip
external_llvm-2076aa800e78a2e196eac47cc8413a074a761d8d.tar.gz
external_llvm-2076aa800e78a2e196eac47cc8413a074a761d8d.tar.bz2
Type of first GEP operand is always the same as the target pointer type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55097 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/SelectionDAG/FastISel.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/CodeGen/SelectionDAG/FastISel.cpp b/lib/CodeGen/SelectionDAG/FastISel.cpp
index eb899e0..dc54485 100644
--- a/lib/CodeGen/SelectionDAG/FastISel.cpp
+++ b/lib/CodeGen/SelectionDAG/FastISel.cpp
@@ -56,9 +56,7 @@ bool FastISel::SelectGetElementPtr(Instruction *I,
return false;
const Type *Ty = I->getOperand(0)->getType();
- MVT VT = MVT::getMVT(Ty, /*HandleUnknown=*/true);
- MVT::SimpleValueType PtrVT = TLI.getPointerTy().getSimpleVT();
-
+ MVT VT = MVT::getMVT(Ty, /*HandleUnknown=*/false);
for (GetElementPtrInst::op_iterator OI = I->op_begin()+1, E = I->op_end();
OI != E; ++OI) {
Value *Idx = *OI;
@@ -69,7 +67,7 @@ bool FastISel::SelectGetElementPtr(Instruction *I,
uint64_t Offs = TD.getStructLayout(StTy)->getElementOffset(Field);
// FIXME: This can be optimized by combining the add with a
// subsequent one.
- N = FastEmit_ri(VT.getSimpleVT(), ISD::ADD, N, Offs, PtrVT);
+ N = FastEmit_ri(VT.getSimpleVT(), ISD::ADD, N, Offs, VT.getSimpleVT());
if (N == 0)
// Unhandled operand. Halt "fast" selection and bail.
return false;
@@ -83,7 +81,7 @@ bool FastISel::SelectGetElementPtr(Instruction *I,
if (CI->getZExtValue() == 0) continue;
uint64_t Offs =
TD.getABITypeSize(Ty)*cast<ConstantInt>(CI)->getSExtValue();
- N = FastEmit_ri(VT.getSimpleVT(), ISD::ADD, N, Offs, PtrVT);
+ N = FastEmit_ri(VT.getSimpleVT(), ISD::ADD, N, Offs, VT.getSimpleVT());
if (N == 0)
// Unhandled operand. Halt "fast" selection and bail.
return false;
@@ -99,7 +97,7 @@ bool FastISel::SelectGetElementPtr(Instruction *I,
// If the index is smaller or larger than intptr_t, truncate or extend
// it.
- MVT IdxVT = MVT::getMVT(Idx->getType(), /*HandleUnknown=*/true);
+ MVT IdxVT = MVT::getMVT(Idx->getType(), /*HandleUnknown=*/false);
if (IdxVT.bitsLT(VT))
IdxN = FastEmit_r(VT.getSimpleVT(), ISD::SIGN_EXTEND, IdxN);
else if (IdxVT.bitsGT(VT))
@@ -111,7 +109,7 @@ bool FastISel::SelectGetElementPtr(Instruction *I,
// FIXME: If multiple is power of two, turn it into a shift. The
// optimization should be in FastEmit_ri?
IdxN = FastEmit_ri(VT.getSimpleVT(), ISD::MUL, IdxN,
- ElementSize, PtrVT);
+ ElementSize, VT.getSimpleVT());
if (IdxN == 0)
// Unhandled operand. Halt "fast" selection and bail.
return false;