From 4c6f2f9e92eae3e676ee09133e9666567782faa3 Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Wed, 31 May 2006 18:03:39 +0000 Subject: [PATCH] commuteInstruction() does not always create a new MI! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28592 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/SelectionDAG/ScheduleDAG.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp b/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp index d2820d96323..1d154017f51 100644 --- a/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp +++ b/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp @@ -402,8 +402,10 @@ void ScheduleDAG::EmitNode(SDNode *Node, DEBUG(std::cerr << "Sched: COMMUTING FAILED!\n"); else { DEBUG(std::cerr << "Sched: COMMUTED TO: " << *NewMI); - delete MI; - MI = NewMI; + if (MI != NewMI) { + delete MI; + MI = NewMI; + } } }