diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp --- a/llvm/lib/Transforms/Scalar/GVN.cpp +++ b/llvm/lib/Transforms/Scalar/GVN.cpp @@ -2087,8 +2087,8 @@ // If "A && B" is known true then both A and B are known true. If "A || B" // is known false then both A and B are known false. Value *A, *B; - if ((isKnownTrue && match(LHS, m_And(m_Value(A), m_Value(B)))) || - (isKnownFalse && match(LHS, m_Or(m_Value(A), m_Value(B))))) { + if ((isKnownTrue && match(LHS, m_LogicalAnd(m_Value(A), m_Value(B)))) || + (isKnownFalse && match(LHS, m_LogicalOr(m_Value(A), m_Value(B))))) { Worklist.push_back(std::make_pair(A, RHS)); Worklist.push_back(std::make_pair(B, RHS)); continue; diff --git a/llvm/test/Transforms/GVN/condprop.ll b/llvm/test/Transforms/GVN/condprop.ll --- a/llvm/test/Transforms/GVN/condprop.ll +++ b/llvm/test/Transforms/GVN/condprop.ll @@ -87,13 +87,13 @@ br i1 %z, label %both_zero, label %nope both_zero: call void @foo(i1 %xz) -; CHECK: call void @foo(i1 %xz) +; CHECK: call void @foo(i1 true) call void @foo(i1 %yz) -; CHECK: call void @foo(i1 %yz) +; CHECK: call void @foo(i1 true) call void @bar(i32 %x) -; CHECK: call void @bar(i32 %x) +; CHECK: call void @bar(i32 0) call void @bar(i32 %y) -; CHECK: call void @bar(i32 %y) +; CHECK: call void @bar(i32 0) ret void nope: call void @foo(i1 %z) @@ -131,13 +131,13 @@ br i1 %z, label %nope, label %both_zero both_zero: call void @foo(i1 %xz) -; CHECK: call void @foo(i1 %xz) +; CHECK: call void @foo(i1 false) call void @foo(i1 %yz) -; CHECK: call void @foo(i1 %yz) +; CHECK: call void @foo(i1 false) call void @bar(i32 %x) -; CHECK: call void @bar(i32 %x) +; CHECK: call void @bar(i32 0) call void @bar(i32 %y) -; CHECK: call void @bar(i32 %y) +; CHECK: call void @bar(i32 0) ret void nope: call void @foo(i1 %z)