Check the VN of the src register at the two copies, not just the
authorRafael Espindola <rafael.espindola@gmail.com>
Sat, 2 Jul 2011 05:34:02 +0000 (05:34 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Sat, 2 Jul 2011 05:34:02 +0000 (05:34 +0000)
register number.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134309 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/RegisterCoalescer.cpp

index d5025b9e636f4f5f51e5c37684a848c1b6a77a4c..13ae04283a9b93eadaa06adddbe86c0760431074 100644 (file)
@@ -1203,7 +1203,6 @@ static bool RegistersDefinedFromSameValue(LiveIntervals &li,
                                           VNInfo *VNI,
                                           LiveRange *LR,
                                      SmallVector<MachineInstr*, 8> &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;