diff options
-rw-r--r-- | lib/Transforms/Scalar/GVNPRE.cpp | 2 | ||||
-rw-r--r-- | test/Transforms/GVNPRE/2007-07-04-CleanSelect.ll | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/GVNPRE.cpp b/lib/Transforms/Scalar/GVNPRE.cpp index 33926ea..5d52aa4 100644 --- a/lib/Transforms/Scalar/GVNPRE.cpp +++ b/lib/Transforms/Scalar/GVNPRE.cpp @@ -1040,7 +1040,7 @@ void GVNPRE::topo_sort(SmallPtrSet<Value*, 16>& set, std::vector<Value*>& vec) { stack.push_back(r); else if (m != 0 && isa<Instruction>(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 0000000..d72e2e1 --- /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 ; <i8> [#uses=2] + %tmp64.i.i51 = sub i8 0, %tmp15.i48 ; <i8> [#uses=1] + %tmp231.i52 = select i1 false, i8 %tmp15.i48, i8 %tmp64.i.i51 ; <i8> [#uses=0] + ret i32* null +} |