summaryrefslogtreecommitdiff
path: root/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-03-14 07:14:25 +0000
committerBill Wendling <isanbard@gmail.com>2012-03-14 07:14:25 +0000
commit7bf116acd417e50f6fac677b9cb9204ee7f35c00 (patch)
tree2184dc44f0b3b5c29beb4fcf2c4f8f29460b3aaa /lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
parent3c88d4a8fb6d39348a1e4a65ca60f5c92571b081 (diff)
downloadllvm-7bf116acd417e50f6fac677b9cb9204ee7f35c00.tar.gz
llvm-7bf116acd417e50f6fac677b9cb9204ee7f35c00.tar.bz2
llvm-7bf116acd417e50f6fac677b9cb9204ee7f35c00.tar.xz
Insert the debugging instructions in one fell-swoop so that it doesn't call the
expensive "getFirstTerminator" call. This reduces the time of compilation in PR12258 from >10 minutes to < 10 seconds. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152704 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp')
-rw-r--r--lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp b/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
index d2aec08534..69dd813b24 100644
--- a/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
+++ b/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
@@ -855,16 +855,17 @@ EmitSchedule(MachineBasicBlock::iterator &InsertPos) {
}
// Add trailing DbgValue's before the terminator. FIXME: May want to add
// some of them before one or more conditional branches?
+ SmallVector<MachineInstr*, 8> DbgMIs;
while (DI != DE) {
- MachineBasicBlock *InsertBB = Emitter.getBlock();
- MachineBasicBlock::iterator Pos= Emitter.getBlock()->getFirstTerminator();
- if (!(*DI)->isInvalidated()) {
- MachineInstr *DbgMI= Emitter.EmitDbgValue(*DI, VRBaseMap);
- if (DbgMI)
- InsertBB->insert(Pos, DbgMI);
- }
+ if (!(*DI)->isInvalidated())
+ if (MachineInstr *DbgMI = Emitter.EmitDbgValue(*DI, VRBaseMap))
+ DbgMIs.push_back(DbgMI);
++DI;
}
+
+ MachineBasicBlock *InsertBB = Emitter.getBlock();
+ MachineBasicBlock::iterator Pos = InsertBB->getFirstTerminator();
+ InsertBB->insert(Pos, DbgMIs.begin(), DbgMIs.end());
}
InsertPos = Emitter.getInsertPos();