From 8f6c6d4c5f7bb9ab71147c8215c3779a6bec7689 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Fri, 14 Nov 2008 00:33:17 +0000 Subject: [PATCH] For post-regalloc scheduling, remove the instructions from the block before re-inserting them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59281 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/SelectionDAG/ScheduleDAGEmit.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/CodeGen/SelectionDAG/ScheduleDAGEmit.cpp b/lib/CodeGen/SelectionDAG/ScheduleDAGEmit.cpp index d60dd493576..0c679734ea1 100644 --- a/lib/CodeGen/SelectionDAG/ScheduleDAGEmit.cpp +++ b/lib/CodeGen/SelectionDAG/ScheduleDAGEmit.cpp @@ -675,6 +675,12 @@ void ScheduleDAG::EmitCrossRCCopy(SUnit *SU, /// EmitSchedule - Emit the machine code in scheduled order. MachineBasicBlock *ScheduleDAG::EmitSchedule() { + // For post-regalloc scheduling, we're rescheduling the instructions in the + // block, so start by removing them from the block. + if (!DAG) + while (!BB->empty()) + BB->remove(BB->begin()); + DenseMap VRBaseMap; DenseMap CopyVRBaseMap; for (unsigned i = 0, e = Sequence.size(); i != e; i++) { -- 2.34.1