From a1dca3553ef4e429ce38e56c8dded33f62788dda Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Mon, 19 Nov 2018 14:42:28 +0000 Subject: [PATCH] [SelectionDAG] simplify select FP with undef condition llvm-svn: 347212 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 2 +- llvm/test/CodeGen/X86/select_const.ll | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 7be9459..1a73a01 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -6784,7 +6784,7 @@ SDValue SelectionDAG::simplifySelect(SDValue Cond, SDValue T, SDValue F) { // select, ?, undef, F --> F // select, ?, T, undef --> T if (Cond.isUndef()) - return isa(T) ? T : F; + return isConstantValueOfAnyType(T) ? T : F; if (T.isUndef()) return F; if (F.isUndef()) diff --git a/llvm/test/CodeGen/X86/select_const.ll b/llvm/test/CodeGen/X86/select_const.ll index 53230e8..0f252c8 100644 --- a/llvm/test/CodeGen/X86/select_const.ll +++ b/llvm/test/CodeGen/X86/select_const.ll @@ -506,6 +506,7 @@ define i64 @opaque_constant(i1 %cond, i64 %x) { 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 -- 2.7.4