[llvm-commits] [PATCH] MachineRegisterInfo: Don't emit the same livein copy more than once

Tom Stellard tstellar at gmail.com
Fri Jan 27 11:56:03 PST 2012


---

Is MachineRegisterInfo::EmitLiveInCopies() only meant to be called once
per compile?  If I call it more than once, it emits duplicate copies
which causes the live interval analysis to fail.

 lib/CodeGen/MachineRegisterInfo.cpp |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/lib/CodeGen/MachineRegisterInfo.cpp b/lib/CodeGen/MachineRegisterInfo.cpp
index 266ebf6..fc787f2 100644
--- a/lib/CodeGen/MachineRegisterInfo.cpp
+++ b/lib/CodeGen/MachineRegisterInfo.cpp
@@ -227,7 +227,9 @@ MachineRegisterInfo::EmitLiveInCopies(MachineBasicBlock *EntryMBB,
         // complicated by the debug info code for arguments.
         LiveIns.erase(LiveIns.begin() + i);
         --i; --e;
-      } else {
+        //Make sure we don't emit the same livein copies twice, in case this
+        //function is called more than once.
+      } else if (def_empty(LiveIns[i].second)) {
         // Emit a copy.
         BuildMI(*EntryMBB, EntryMBB->begin(), DebugLoc(),
                 TII.get(TargetOpcode::COPY), LiveIns[i].second)
-- 
1.7.6.4




More information about the llvm-commits mailing list