[SelectionDAG] Don't crash when freezing illegal float types · llvm/llvm-project@0019c2f (original) (raw)

2 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -2456,6 +2456,7 @@ void DAGTypeLegalizer::SoftPromoteHalfResult(SDNode *N, unsigned ResNo) {
2456 2456 case ISD::FLOG10:
2457 2457 case ISD::FNEARBYINT:
2458 2458 case ISD::FNEG:
2459 +case ISD::FREEZE:
2459 2460 case ISD::FRINT:
2460 2461 case ISD::FROUND:
2461 2462 case ISD::FSIN:
Original file line number Diff line number Diff line change
@@ -33,6 +33,26 @@ define float @freeze_float() {
33 33 ret float %t1
34 34 }
35 35
36 +define half @freeze_half() {
37 +; X86ASM-LABEL: freeze_half:
38 +; X86ASM: # %bb.0:
39 +; X86ASM-NEXT: pushq %rax
40 +; X86ASM-NEXT: .cfi_def_cfa_offset 16
41 +; X86ASM-NEXT: xorl %edi, %edi
42 +; X86ASM-NEXT: callq __gnu_h2f_ieee
43 +; X86ASM-NEXT: callq __gnu_f2h_ieee
44 +; X86ASM-NEXT: movzwl %ax, %edi
45 +; X86ASM-NEXT: callq __gnu_h2f_ieee
46 +; X86ASM-NEXT: addss %xmm0, %xmm0
47 +; X86ASM-NEXT: callq __gnu_f2h_ieee
48 +; X86ASM-NEXT: popq %rcx
49 +; X86ASM-NEXT: .cfi_def_cfa_offset 8
50 +; X86ASM-NEXT: retq
51 +%y1 = freeze half undef
52 +%t1 = fadd half %y1, %y1
53 +ret half %t1
54 +}
55 +
36 56 define <2 x i32> @freeze_ivec() {
37 57 ; X86ASM-LABEL: freeze_ivec:
38 58 ; X86ASM: # %bb.0: