[llvm-commits] [llvm] r37967 - in /llvm/trunk: lib/Transforms/Scalar/GVNPRE.cpp test/Transforms/GVNPRE/2007-07-07-AnticOutUnique.ll

Owen Anderson resistor at mac.com
Sat Jul 7 13:13:58 PDT 2007


Author: resistor
Date: Sat Jul  7 15:13:57 2007
New Revision: 37967

URL: http://llvm.org/viewvc/llvm-project?rev=37967&view=rev
Log:
Fix an error where ANTIC_OUT was ending up with more than one expression of
the same value number.  This fixes an infinite loop on 444.namd.

Added:
    llvm/trunk/test/Transforms/GVNPRE/2007-07-07-AnticOutUnique.ll
Modified:
    llvm/trunk/lib/Transforms/Scalar/GVNPRE.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/GVNPRE.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVNPRE.cpp?rev=37967&r1=37966&r2=37967&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/GVNPRE.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/GVNPRE.cpp Sat Jul  7 15:13:57 2007
@@ -1370,7 +1370,7 @@
     unsigned num = VN.lookup_or_add(*I);
     numbers.resize(VN.size());
     
-    if (isa<Instruction>(*I)) {
+    if (isa<Instruction>(*I) && !numbers.test(num)) {
       anticIn.insert(*I);
       numbers.set(num);
     }

Added: llvm/trunk/test/Transforms/GVNPRE/2007-07-07-AnticOutUnique.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/GVNPRE/2007-07-07-AnticOutUnique.ll?rev=37967&view=auto

==============================================================================
--- llvm/trunk/test/Transforms/GVNPRE/2007-07-07-AnticOutUnique.ll (added)
+++ llvm/trunk/test/Transforms/GVNPRE/2007-07-07-AnticOutUnique.ll Sat Jul  7 15:13:57 2007
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | opt -gvnpre | llvm-dis
+	%"struct.ObjectArena<char>" = type { i32, i32, %"struct.ResizeArray<char*>", i8*, i8* }
+	%"struct.ResizeArray<char*>" = type { i32 (...)**, %"struct.ResizeArrayRaw<char*>"* }
+	%"struct.ResizeArrayRaw<char*>" = type { i8**, i8*, i32, i32, i32, float, i32 }
+
+define void @_ZN11ObjectArenaIcED1Ev(%"struct.ObjectArena<char>"* %this) {
+entry:
+	br label %cond_true21
+
+cond_true21:		; preds = %cond_true21, %entry
+	%tmp215.0 = phi %"struct.ResizeArray<char*>"* [ null, %entry ], [ null, %cond_true21 ]		; <%"struct.ResizeArray<char*>"*> [#uses=1]
+	%tmp2.i2 = getelementptr %"struct.ResizeArray<char*>"* %tmp215.0, i32 0, i32 1		; <%"struct.ResizeArrayRaw<char*>"**> [#uses=0]
+	br label %cond_true21
+}





More information about the llvm-commits mailing list