From ecc8af61e78bce8075475a947538f7599aa0587e Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Sun, 7 Oct 2018 16:30:42 +0000 Subject: [PATCH] [DAGCombiner] allow undef elts in vector fadd matching llvm-svn: 343945 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 2 +- llvm/test/CodeGen/X86/fadd-combines.ll | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 69ed030..e4b8d8e 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -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; diff --git a/llvm/test/CodeGen/X86/fadd-combines.ll b/llvm/test/CodeGen/X86/fadd-combines.ll index efd31d4..fdd83da 100644 --- a/llvm/test/CodeGen/X86/fadd-combines.ll +++ b/llvm/test/CodeGen/X86/fadd-combines.ll @@ -20,8 +20,6 @@ define <4 x float> @fadd_zero_4f32(<4 x float> %x) #0 { 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, ret <4 x float> %y -- 2.7.4