aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-07-07 21:18:22 +0000
committerDan Gohman <gohman@apple.com>2010-07-07 21:18:22 +0000
commit5c480432b504bfbe8b3ba028f5f48e7e2e2f1f1e (patch)
tree25fb8e58d484d83027a18d6b72bac134a0daf01e
parent26b8ef53ff2ff1ffd72d140b5be264e32dee0195 (diff)
Not all custom inserters create new basic blocks. If the inserter
didn't create a new block, don't reset the insert position. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107813 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/SelectionDAG/InstrEmitter.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/CodeGen/SelectionDAG/InstrEmitter.cpp b/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
index f36620c3ed..5f93e2fcb2 100644
--- a/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
+++ b/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
@@ -732,8 +732,11 @@ EmitMachineNode(SDNode *Node, bool IsClone, bool IsCloned,
if (II.usesCustomInsertionHook()) {
// Insert this instruction into the basic block using a target
// specific inserter which may returns a new basic block.
- MBB = TLI->EmitInstrWithCustomInserter(MI, MBB);
- InsertPos = MBB->end();
+ MachineBasicBlock *NewMBB = TLI->EmitInstrWithCustomInserter(MI, MBB);
+ if (NewMBB != MBB) {
+ MBB = NewMBB;
+ InsertPos = NewMBB->end();
+ }
return;
}