Don't create IRBuilder if we can return from the method earlier.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176660 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jakub Staszak 2013-03-07 22:10:33 +00:00
parent 4fde76db46
commit 9497005d38

View File

@ -1571,13 +1571,13 @@ private:
void visitSelectInst(SelectInst &SI) { void visitSelectInst(SelectInst &SI) {
DEBUG(dbgs() << " original: " << SI << "\n"); DEBUG(dbgs() << " original: " << SI << "\n");
IRBuilder<> IRB(&SI);
// If the select isn't safe to speculate, just use simple logic to emit it. // If the select isn't safe to speculate, just use simple logic to emit it.
SmallVector<LoadInst *, 4> Loads; SmallVector<LoadInst *, 4> Loads;
if (!isSafeSelectToSpeculate(SI, Loads)) if (!isSafeSelectToSpeculate(SI, Loads))
return; return;
IRBuilder<> IRB(&SI);
Use *Ops[2] = { &SI.getOperandUse(1), &SI.getOperandUse(2) }; Use *Ops[2] = { &SI.getOperandUse(1), &SI.getOperandUse(2) };
AllocaPartitioning::iterator PIs[2]; AllocaPartitioning::iterator PIs[2];
AllocaPartitioning::PartitionUse PUs[2]; AllocaPartitioning::PartitionUse PUs[2];
@ -2450,7 +2450,6 @@ private:
DEBUG(dbgs() << " original: " << LI << "\n"); DEBUG(dbgs() << " original: " << LI << "\n");
Value *OldOp = LI.getOperand(0); Value *OldOp = LI.getOperand(0);
assert(OldOp == OldPtr); assert(OldOp == OldPtr);
IRBuilder<> IRB(&LI);
uint64_t Size = EndOffset - BeginOffset; uint64_t Size = EndOffset - BeginOffset;
bool IsSplitIntLoad = Size < TD.getTypeStoreSize(LI.getType()); bool IsSplitIntLoad = Size < TD.getTypeStoreSize(LI.getType());
@ -2471,6 +2470,7 @@ private:
return true; return true;
} }
IRBuilder<> IRB(&LI);
Type *TargetTy = IsSplitIntLoad ? Type::getIntNTy(LI.getContext(), Size * 8) Type *TargetTy = IsSplitIntLoad ? Type::getIntNTy(LI.getContext(), Size * 8)
: LI.getType(); : LI.getType();
bool IsPtrAdjusted = false; bool IsPtrAdjusted = false;