[llvm] r364592 - [GVN] Add support for unary FNeg to GVN pass
Cameron McInally via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 27 14:05:03 PDT 2019
Author: mcinally
Date: Thu Jun 27 14:05:02 2019
New Revision: 364592
URL: http://llvm.org/viewvc/llvm-project?rev=364592&view=rev
Log:
[GVN] Add support for unary FNeg to GVN pass
Differential Revision: https://reviews.llvm.org/D63896
Modified:
llvm/trunk/lib/Transforms/Scalar/GVN.cpp
llvm/trunk/test/Transforms/GVN/fpmath.ll
Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVN.cpp?rev=364592&r1=364591&r2=364592&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Thu Jun 27 14:05:02 2019
@@ -492,6 +492,7 @@ uint32_t GVN::ValueTable::lookupOrAdd(Va
switch (I->getOpcode()) {
case Instruction::Call:
return lookupOrAddCall(cast<CallInst>(I));
+ case Instruction::FNeg:
case Instruction::Add:
case Instruction::FAdd:
case Instruction::Sub:
Modified: llvm/trunk/test/Transforms/GVN/fpmath.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/GVN/fpmath.ll?rev=364592&r1=364591&r2=364592&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/GVN/fpmath.ll (original)
+++ llvm/trunk/test/Transforms/GVN/fpmath.ll Thu Jun 27 14:05:02 2019
@@ -43,9 +43,8 @@ define double @test4(double %x, double %
define double @test5(double %x, double %y) {
; CHECK: @test5(double %x, double %y)
-; 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
More information about the llvm-commits
mailing list