[llvm-branch-commits] [llvm-branch] r70041 - in /llvm/branches/Apple/Dib: include/llvm/CodeGen/LiveInterval.h lib/CodeGen/LiveInterval.cpp test/CodeGen/X86/2009-04-25-CoalescerBug.ll

Bill Wendling isanbard at gmail.com
Sat Apr 25 05:21:01 PDT 2009


Author: void
Date: Sat Apr 25 07:20:58 2009
New Revision: 70041

URL: http://llvm.org/viewvc/llvm-project?rev=70041&view=rev
Log:
Temporarily revert r70026 from Dib. It was going into an infinite loop during a
bootstrap in x86_64 mode.

Removed:
    llvm/branches/Apple/Dib/test/CodeGen/X86/2009-04-25-CoalescerBug.ll
Modified:
    llvm/branches/Apple/Dib/include/llvm/CodeGen/LiveInterval.h
    llvm/branches/Apple/Dib/lib/CodeGen/LiveInterval.cpp

Modified: llvm/branches/Apple/Dib/include/llvm/CodeGen/LiveInterval.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/include/llvm/CodeGen/LiveInterval.h?rev=70041&r1=70040&r2=70041&view=diff

==============================================================================
--- llvm/branches/Apple/Dib/include/llvm/CodeGen/LiveInterval.h (original)
+++ llvm/branches/Apple/Dib/include/llvm/CodeGen/LiveInterval.h Sat Apr 25 07:20:58 2009
@@ -213,6 +213,10 @@
       return VNI;
     }
 
+    /// getUnknownValNo - Find a value# for unknown values, if there isn't one
+    /// create a new one.
+    VNInfo *getUnknownValNo(BumpPtrAllocator &VNInfoAllocator);
+
     /// addKill - Add a kill instruction index to the specified value
     /// number.
     static void addKill(VNInfo *VNI, unsigned KillIdx) {

Modified: llvm/branches/Apple/Dib/lib/CodeGen/LiveInterval.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/LiveInterval.cpp?rev=70041&r1=70040&r2=70041&view=diff

==============================================================================
--- llvm/branches/Apple/Dib/lib/CodeGen/LiveInterval.cpp (original)
+++ llvm/branches/Apple/Dib/lib/CodeGen/LiveInterval.cpp Sat Apr 25 07:20:58 2009
@@ -19,7 +19,6 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/CodeGen/LiveInterval.h"
-#include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallSet.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Support/Streams.h"
@@ -568,6 +567,20 @@
   }
 }
 
+VNInfo *LiveInterval::getUnknownValNo(BumpPtrAllocator &VNInfoAllocator) {
+  unsigned i = getNumValNums();
+  if (i) {
+    do {
+      --i;
+      VNInfo *VNI = getValNumInfo(i);
+      if (VNI->def == ~0U && !VNI->copy &&
+          !VNI->hasPHIKill && !VNI->redefByEC && VNI->kills.empty())
+        return VNI;
+    } while (i != 0);
+  }
+  return getNextValue(~0U, 0, VNInfoAllocator);
+}
+
 
 /// MergeInClobberRanges - For any live ranges that are not defined in the
 /// current interval, but are defined in the Clobbers interval, mark them
@@ -576,19 +589,12 @@
                                         BumpPtrAllocator &VNInfoAllocator) {
   if (Clobbers.empty()) return;
   
-  DenseMap<VNInfo*, VNInfo*> ValNoMaps;
+  // Find a value # to use for the clobber ranges.  If there is already a value#
+  // for unknown values, use it.
+  VNInfo *ClobberValNo = getUnknownValNo(VNInfoAllocator);
+  
   iterator IP = begin();
   for (const_iterator I = Clobbers.begin(), E = Clobbers.end(); I != E; ++I) {
-    // For every val# in the Clobbers interval, create a new "unknown" val#.
-    VNInfo *ClobberValNo = 0;
-    DenseMap<VNInfo*, VNInfo*>::iterator VI = ValNoMaps.find(I->valno);
-    if (VI != ValNoMaps.end())
-      ClobberValNo = VI->second;
-    else {
-      ClobberValNo = getNextValue(~0U, 0, VNInfoAllocator);
-      ValNoMaps.insert(std::make_pair(I->valno, ClobberValNo));
-    }
-
     bool Done = false;
     unsigned Start = I->start, End = I->end;
     // If a clobber range starts before an existing range and ends after
@@ -631,7 +637,7 @@
                                        BumpPtrAllocator &VNInfoAllocator) {
   // Find a value # to use for the clobber ranges.  If there is already a value#
   // for unknown values, use it.
-  VNInfo *ClobberValNo = getNextValue(~0U, 0, VNInfoAllocator);
+  VNInfo *ClobberValNo = getUnknownValNo(VNInfoAllocator);
   
   iterator IP = begin();
   IP = std::upper_bound(IP, end(), Start);

Removed: llvm/branches/Apple/Dib/test/CodeGen/X86/2009-04-25-CoalescerBug.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/test/CodeGen/X86/2009-04-25-CoalescerBug.ll?rev=70040&view=auto

==============================================================================
--- llvm/branches/Apple/Dib/test/CodeGen/X86/2009-04-25-CoalescerBug.ll (original)
+++ llvm/branches/Apple/Dib/test/CodeGen/X86/2009-04-25-CoalescerBug.ll (removed)
@@ -1,19 +0,0 @@
-; RUN: llvm-as < %s | llc -march=x86-64 | grep mov | count 2
-; rdar://6806252
-
-define i64 @test(i32* %tmp13) nounwind {
-entry:
-	br label %while.cond
-
-while.cond:		; preds = %while.cond, %entry
-	%tmp15 = load i32* %tmp13		; <i32> [#uses=2]
-	%bf.lo = lshr i32 %tmp15, 1		; <i32> [#uses=1]
-	%bf.lo.cleared = and i32 %bf.lo, 2147483647		; <i32> [#uses=1]
-	%conv = zext i32 %bf.lo.cleared to i64		; <i64> [#uses=1]
-	%bf.lo.cleared25 = and i32 %tmp15, 1		; <i32> [#uses=1]
-	%tobool = icmp ne i32 %bf.lo.cleared25, 0		; <i1> [#uses=1]
-	br i1 %tobool, label %while.cond, label %while.end
-
-while.end:		; preds = %while.cond
-	ret i64 %conv
-}





More information about the llvm-branch-commits mailing list