Fix build with LLVM 2.9.

This commit is contained in:
Matt Pharr
2012-04-05 08:22:40 -07:00
parent 1dac05960a
commit 4c9ac7fcf1
2 changed files with 12 additions and 1 deletions

View File

@@ -1443,7 +1443,10 @@ lExtractFirstVectorElement(llvm::Value *v, llvm::Instruction *insertBefore,
llvm::Instruction *phiInsertPos = phi->getParent()->begin(); llvm::Instruction *phiInsertPos = phi->getParent()->begin();
llvm::PHINode *scalarPhi = llvm::PHINode *scalarPhi =
llvm::PHINode::Create(vt->getElementType(), llvm::PHINode::Create(vt->getElementType(),
phi->getNumIncomingValues(), newName, #ifndef LLVM_2_9
phi->getNumIncomingValues(),
#endif // !LLVM_2_9
newName,
phiInsertPos); phiInsertPos);
phiMap[phi] = scalarPhi; phiMap[phi] = scalarPhi;

View File

@@ -1130,7 +1130,11 @@ lExtractFromInserts(llvm::Value *v, unsigned int index) {
return NULL; return NULL;
Assert(iv->hasIndices() && iv->getNumIndices() == 1); Assert(iv->hasIndices() && iv->getNumIndices() == 1);
#ifdef LLVM_2_9
if (*(iv->idx_begin()) == index)
#else
if (iv->getIndices()[0] == index) if (iv->getIndices()[0] == index)
#endif
return iv->getInsertedValueOperand(); return iv->getInsertedValueOperand();
else else
return lExtractFromInserts(iv->getAggregateOperand(), index); return lExtractFromInserts(iv->getAggregateOperand(), index);
@@ -1260,7 +1264,11 @@ lGetBasePtrAndOffsets(llvm::Value *ptrs, llvm::Value **offsets,
llvm::ExtractValueInst *ev = llvm::dyn_cast<llvm::ExtractValueInst>(ptrs); llvm::ExtractValueInst *ev = llvm::dyn_cast<llvm::ExtractValueInst>(ptrs);
if (ev != NULL) { if (ev != NULL) {
Assert(ev->getNumIndices() == 1); Assert(ev->getNumIndices() == 1);
#ifdef LLVM_2_9
int index = *(ev->idx_begin());
#else
int index = ev->getIndices()[0]; int index = ev->getIndices()[0];
#endif
ptrs = lExtractFromInserts(ev->getAggregateOperand(), index); ptrs = lExtractFromInserts(ev->getAggregateOperand(), index);
if (ptrs != NULL) if (ptrs != NULL)
return lGetBasePtrAndOffsets(ptrs, offsets, insertBefore); return lGetBasePtrAndOffsets(ptrs, offsets, insertBefore);