From a9badd250cac2e5090eb950bb0456c37ee6c8f7a Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Sat, 2 Jul 2011 05:34:02 +0000 Subject: [PATCH] Check the VN of the src register at the two copies, not just the register number. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134309 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/RegisterCoalescer.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/CodeGen/RegisterCoalescer.cpp b/lib/CodeGen/RegisterCoalescer.cpp index d5025b9e636..13ae04283a9 100644 --- a/lib/CodeGen/RegisterCoalescer.cpp +++ b/lib/CodeGen/RegisterCoalescer.cpp @@ -1203,7 +1203,6 @@ static bool RegistersDefinedFromSameValue(LiveIntervals &li, VNInfo *VNI, LiveRange *LR, SmallVector &DupCopies) { - return false; // To see if this fixes the i386 dragonegg buildbot miscompile. // FIXME: This is very conservative. For example, we don't handle // physical registers. @@ -1252,6 +1251,12 @@ static bool RegistersDefinedFromSameValue(LiveIntervals &li, if (Src != OtherSrc) return false; + // If the copies use two different value numbers of X, we cannot merge + // A and B. + if (SrcInt.FindLiveRangeContaining(Other->def)->valno != + SrcInt.FindLiveRangeContaining(VNI->def)->valno) + return false; + DupCopies.push_back(MI); return true;