Skip to content

Commit

Permalink
[SelectionDAG] Don't crash when freezing illegal float types
Browse files Browse the repository at this point in the history
  • Loading branch information
d0k committed Mar 24, 2020
1 parent 0c24adc commit 0019c2f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2456,6 +2456,7 @@ void DAGTypeLegalizer::SoftPromoteHalfResult(SDNode *N, unsigned ResNo) {
case ISD::FLOG10:
case ISD::FNEARBYINT:
case ISD::FNEG:
case ISD::FREEZE:
case ISD::FRINT:
case ISD::FROUND:
case ISD::FSIN:
Expand Down
20 changes: 20 additions & 0 deletions llvm/test/CodeGen/X86/freeze.ll
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,26 @@ define float @freeze_float() {
ret float %t1
}

define half @freeze_half() {
; X86ASM-LABEL: freeze_half:
; X86ASM: # %bb.0:
; X86ASM-NEXT: pushq %rax
; X86ASM-NEXT: .cfi_def_cfa_offset 16
; X86ASM-NEXT: xorl %edi, %edi
; X86ASM-NEXT: callq __gnu_h2f_ieee
; X86ASM-NEXT: callq __gnu_f2h_ieee
; X86ASM-NEXT: movzwl %ax, %edi
; X86ASM-NEXT: callq __gnu_h2f_ieee
; X86ASM-NEXT: addss %xmm0, %xmm0
; X86ASM-NEXT: callq __gnu_f2h_ieee
; X86ASM-NEXT: popq %rcx
; X86ASM-NEXT: .cfi_def_cfa_offset 8
; X86ASM-NEXT: retq
%y1 = freeze half undef
%t1 = fadd half %y1, %y1
ret half %t1
}

define <2 x i32> @freeze_ivec() {
; X86ASM-LABEL: freeze_ivec:
; X86ASM: # %bb.0:
Expand Down

0 comments on commit 0019c2f

Please sign in to comment.