From: Cameron McInally Date: Fri, 28 Jun 2019 20:09:32 +0000 (+0000) Subject: [NewGVN] Add unary FNeg support to NewGVN pass X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=55848f68977f1fffbb24a03139201767388ed633;p=llvm [NewGVN] Add unary FNeg support to NewGVN pass Differential Revision: https://reviews.llvm.org/D63933 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364680 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Scalar/NewGVN.cpp b/lib/Transforms/Scalar/NewGVN.cpp index 99e18198df2..08ac2b666fc 100644 --- a/lib/Transforms/Scalar/NewGVN.cpp +++ b/lib/Transforms/Scalar/NewGVN.cpp @@ -1991,6 +1991,7 @@ NewGVN::performSymbolicEvaluation(Value *V, case Instruction::FCmp: E = performSymbolicCmpEvaluation(I); break; + case Instruction::FNeg: case Instruction::Add: case Instruction::FAdd: case Instruction::Sub: diff --git a/test/Transforms/NewGVN/fpmath.ll b/test/Transforms/NewGVN/fpmath.ll index 6933ba3344c..8098bbfc1ce 100644 --- a/test/Transforms/NewGVN/fpmath.ll +++ b/test/Transforms/NewGVN/fpmath.ll @@ -43,9 +43,8 @@ define double @test4(double %x, double %y) { define double @test5(double %x) { ; CHECK: @test5(double %x) -; CHECK: %neg1 = fneg double %x, !fpmath !0 -; CHECK: %neg2 = fneg double %x, !fpmath !1 -; CHECK: %foo = fadd double %neg1, %neg2 +; CHECK: %neg1 = fneg double %x, !fpmath !1 +; CHECK: %foo = fadd double %neg1, %neg1 %neg1 = fneg double %x, !fpmath !0 %neg2 = fneg double %x, !fpmath !1 %foo = fadd double %neg1, %neg2