[SelectionDAG] simplify select FP with undef condition

llvm-svn: 347212
This commit is contained in:
Sanjay Patel 2018-11-19 14:42:28 +00:00
parent 7a51bdcf3b
commit a1dca3553e
2 changed files with 2 additions and 1 deletions

View File

@ -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<ConstantSDNode>(T) ? T : F;
return isConstantValueOfAnyType(T) ? T : F;
if (T.isUndef())
return F;
if (F.isUndef())

View File

@ -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