[llvm] r343945 - [DAGCombiner] allow undef elts in vector fadd matching

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 7 09:30:42 PDT 2018


Author: spatel
Date: Sun Oct  7 09:30:42 2018
New Revision: 343945

URL: http://llvm.org/viewvc/llvm-project?rev=343945&view=rev
Log:
[DAGCombiner] allow undef elts in vector fadd matching

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
    llvm/trunk/test/CodeGen/X86/fadd-combines.ll

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=343945&r1=343944&r2=343945&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Sun Oct  7 09:30:42 2018
@@ -10865,7 +10865,7 @@ SDValue DAGCombiner::visitFADD(SDNode *N
     return DAG.getNode(ISD::FADD, DL, VT, N1, N0, Flags);
 
   // N0 + -0.0 --> N0 (also allowed with +0.0 and fast-math)
-  ConstantFPSDNode *N1C = isConstOrConstSplatFP(N1);
+  ConstantFPSDNode *N1C = isConstOrConstSplatFP(N1, true);
   if (N1C && N1C->isZero())
     if (N1C->isNegative() || Options.UnsafeFPMath || Flags.hasNoSignedZeros())
       return N0;

Modified: llvm/trunk/test/CodeGen/X86/fadd-combines.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/fadd-combines.ll?rev=343945&r1=343944&r2=343945&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/fadd-combines.ll (original)
+++ llvm/trunk/test/CodeGen/X86/fadd-combines.ll Sun Oct  7 09:30:42 2018
@@ -20,8 +20,6 @@ define <4 x float> @fadd_zero_4f32(<4 x
 define <4 x float> @fadd_zero_4f32_undef(<4 x float> %x) {
 ; CHECK-LABEL: fadd_zero_4f32_undef:
 ; CHECK:       # %bb.0:
-; CHECK-NEXT:    xorps %xmm1, %xmm1
-; CHECK-NEXT:    addps %xmm1, %xmm0
 ; CHECK-NEXT:    retq
   %y = fadd nsz <4 x float> %x, <float 0.0, float undef, float 0.0, float undef>
   ret <4 x float> %y




More information about the llvm-commits mailing list