[llvm-commits] [PATCH] MachineRegisterInfo: Don't emit the same livein copy more than once
Tom Stellard
thomas.stellard at amd.com
Fri Feb 3 10:55:49 PST 2012
On Fri, Jan 27, 2012 at 02:56:03PM -0500, Tom Stellard wrote:
> ---
>
> 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
>
>
Reposting this as a diff that can be applied via patch -P0 for SVN
users.
-Tom
-------------- next part --------------
diff --git lib/CodeGen/MachineRegisterInfo.cpp lib/CodeGen/MachineRegisterInfo.cpp
index 6ec55247..749db2a 100644
--- lib/CodeGen/MachineRegisterInfo.cpp
+++ lib/CodeGen/MachineRegisterInfo.cpp
@@ -229,7 +229,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)
More information about the llvm-commits
mailing list