[llvm] r347212 - [SelectionDAG] simplify select FP with undef condition

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 19 06:42:28 PST 2018


Author: spatel
Date: Mon Nov 19 06:42:28 2018
New Revision: 347212

URL: http://llvm.org/viewvc/llvm-project?rev=347212&view=rev
Log:
[SelectionDAG] simplify select FP with undef condition

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
    llvm/trunk/test/CodeGen/X86/select_const.ll

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=347212&r1=347211&r2=347212&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Nov 19 06:42:28 2018
@@ -6784,7 +6784,7 @@ SDValue SelectionDAG::simplifySelect(SDV
   // select, ?, undef, F --> F
   // select, ?, T, undef --> T
   if (Cond.isUndef())
-    return isa<ConstantSDNode>(T) ? T : F;
+    return isConstantValueOfAnyType(T) ? T : F;
   if (T.isUndef())
     return F;
   if (F.isUndef())

Modified: llvm/trunk/test/CodeGen/X86/select_const.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/select_const.ll?rev=347212&r1=347211&r2=347212&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/select_const.ll (original)
+++ llvm/trunk/test/CodeGen/X86/select_const.ll Mon Nov 19 06:42:28 2018
@@ -506,6 +506,7 @@ define i64 @opaque_constant(i1 %cond, i6
 define float @select_undef_fp(float %x) {
 ; CHECK-LABEL: select_undef_fp:
 ; CHECK:       # %bb.0:
+; CHECK-NEXT:    movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
 ; CHECK-NEXT:    retq
   %f = select i1 undef, float 4.0, float %x
   ret float %f




More information about the llvm-commits mailing list