From 36a07daabd1919d6c12b8f55b101d54c3d7171cd Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Sat, 7 Jul 2007 20:13:57 +0000 Subject: [PATCH] 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37967 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/GVNPRE.cpp | 2 +- .../Transforms/GVNPRE/2007-07-07-AnticOutUnique.ll | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 test/Transforms/GVNPRE/2007-07-07-AnticOutUnique.ll diff --git a/lib/Transforms/Scalar/GVNPRE.cpp b/lib/Transforms/Scalar/GVNPRE.cpp index 0661c94dbd7..44846cb0df4 100644 --- a/lib/Transforms/Scalar/GVNPRE.cpp +++ b/lib/Transforms/Scalar/GVNPRE.cpp @@ -1370,7 +1370,7 @@ unsigned GVNPRE::buildsets_anticin(BasicBlock* BB, unsigned num = VN.lookup_or_add(*I); numbers.resize(VN.size()); - if (isa(*I)) { + if (isa(*I) && !numbers.test(num)) { anticIn.insert(*I); numbers.set(num); } diff --git a/test/Transforms/GVNPRE/2007-07-07-AnticOutUnique.ll b/test/Transforms/GVNPRE/2007-07-07-AnticOutUnique.ll new file mode 100644 index 00000000000..2a7e49c6cd9 --- /dev/null +++ b/test/Transforms/GVNPRE/2007-07-07-AnticOutUnique.ll @@ -0,0 +1,14 @@ +; RUN: llvm-as < %s | opt -gvnpre | llvm-dis + %"struct.ObjectArena" = type { i32, i32, %"struct.ResizeArray", i8*, i8* } + %"struct.ResizeArray" = type { i32 (...)**, %"struct.ResizeArrayRaw"* } + %"struct.ResizeArrayRaw" = type { i8**, i8*, i32, i32, i32, float, i32 } + +define void @_ZN11ObjectArenaIcED1Ev(%"struct.ObjectArena"* %this) { +entry: + br label %cond_true21 + +cond_true21: ; preds = %cond_true21, %entry + %tmp215.0 = phi %"struct.ResizeArray"* [ null, %entry ], [ null, %cond_true21 ] ; <%"struct.ResizeArray"*> [#uses=1] + %tmp2.i2 = getelementptr %"struct.ResizeArray"* %tmp215.0, i32 0, i32 1 ; <%"struct.ResizeArrayRaw"**> [#uses=0] + br label %cond_true21 +}