From ac8fe6b8cae0e4c391f4e42a9329972559686e78 Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Wed, 4 Jul 2007 18:26:18 +0000 Subject: [PATCH] Fix a typo that was killing GVNPRE of select instructions. llvm-svn: 37871 --- lib/Transforms/Scalar/GVNPRE.cpp | 2 +- test/Transforms/GVNPRE/2007-07-04-CleanSelect.ll | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 test/Transforms/GVNPRE/2007-07-04-CleanSelect.ll diff --git a/lib/Transforms/Scalar/GVNPRE.cpp b/lib/Transforms/Scalar/GVNPRE.cpp index 33926ea127a..5d52aa48875 100644 --- a/lib/Transforms/Scalar/GVNPRE.cpp +++ b/lib/Transforms/Scalar/GVNPRE.cpp @@ -1040,7 +1040,7 @@ void GVNPRE::topo_sort(SmallPtrSet& set, std::vector& vec) { stack.push_back(r); else if (m != 0 && isa(m) && visited.count(m) == 0) - stack.push_back(r); + stack.push_back(m); else { vec.push_back(e); visited.insert(e); diff --git a/test/Transforms/GVNPRE/2007-07-04-CleanSelect.ll b/test/Transforms/GVNPRE/2007-07-04-CleanSelect.ll new file mode 100644 index 00000000000..d72e2e1eb51 --- /dev/null +++ b/test/Transforms/GVNPRE/2007-07-04-CleanSelect.ll @@ -0,0 +1,9 @@ +; RUN: llvm-as < %s | opt -gvnpre | llvm-dis + +define i32* @_ZN6Solver9propagateEv(i32* %this) { +entry: + %tmp15.i48 = load i8* null ; [#uses=2] + %tmp64.i.i51 = sub i8 0, %tmp15.i48 ; [#uses=1] + %tmp231.i52 = select i1 false, i8 %tmp15.i48, i8 %tmp64.i.i51 ; [#uses=0] + ret i32* null +}