xref: /llvm-project/llvm/test/CodeGen/X86/break-false-dep-crash.mir (revision aa5cc39b6df0c35ff48cb9d1a397cb8fe1ba00ee)
1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 2
2# RUN: llc -run-pass=break-false-deps -verify-machineinstrs %s -o - | FileCheck %s
3#
4# Check that BreakFalseDeps pass does not crash in presense of dead blocks.
5--- |
6  ; ModuleID = 'repro.ll'
7  target datalayout = "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:32-n8:16:32-S128"
8  target triple = "i686-unknown-unknown"
9
10  declare fastcc void @hoge() #0
11
12  ; Function Attrs: nounwind
13  define fastcc void @widget(i32 %arg) #1 {
14  bb:
15    br label %bb1
16
17  bb1:                                              ; preds = %bb1, %bb
18    %phi = phi i1 [ true, %bb ], [ false, %bb1 ]
19    br i1 %phi, label %bb1, label %bb2
20
21  bb2:                                              ; preds = %bb1
22    br i1 %phi, label %bb4, label %bb3
23
24  bb3:                                              ; preds = %bb2
25    ret void
26
27  bb4:                                              ; preds = %bb2
28    br label %bb5
29
30  bb5:                                              ; preds = %bb5, %bb4
31    %phi6 = phi double [ 0.000000e+00, %bb4 ], [ %fmul, %bb5 ]
32    %fptosi = fptosi double %phi6 to i32
33    %icmp = icmp slt i32 %fptosi, %arg
34    %select = select i1 %icmp, i32 %fptosi, i32 0
35    %sitofp = sitofp i32 %select to double
36    %fsub = fsub double 0.000000e+00, %sitofp
37    %fmul = fmul double 0.000000e+00, %fsub
38    br label %bb5
39  }
40
41  declare fastcc void @quux() #0
42
43  declare fastcc void @hoge.1() #0
44
45  declare fastcc void @barney() #0
46
47  declare fastcc void @ham() #0
48
49  declare fastcc void @wombat() #0
50
51  attributes #0 = { "target-features"="+sse2" }
52  attributes #1 = { nounwind "target-features"="+sse2" }
53
54...
55---
56name:            widget
57alignment:       16
58exposesReturnsTwice: false
59legalized:       false
60regBankSelected: false
61selected:        false
62failedISel:      false
63tracksRegLiveness: true
64hasWinCFI:       false
65callsEHReturn:   false
66callsUnwindInit: false
67hasEHCatchret:   false
68hasEHScopes:     false
69hasEHFunclets:   false
70isOutlined:      false
71debugInstrRef:   false
72failsVerification: false
73tracksDebugUserValues: true
74registers:       []
75liveins:
76  - { reg: '$ecx', virtual-reg: '' }
77frameInfo:
78  isFrameAddressTaken: false
79  isReturnAddressTaken: false
80  hasStackMap:     false
81  hasPatchPoint:   false
82  stackSize:       0
83  offsetAdjustment: 0
84  maxAlignment:    1
85  adjustsStack:    false
86  hasCalls:        false
87  stackProtector:  ''
88  functionContext: ''
89  maxCallFrameSize: 0
90  cvBytesOfCalleeSavedRegisters: 0
91  hasOpaqueSPAdjustment: false
92  hasVAStart:      false
93  hasMustTailInVarArgFunc: false
94  hasTailCall:     false
95  localFrameSize:  0
96  savePoint:       ''
97  restorePoint:    ''
98fixedStack:      []
99stack:           []
100callSites:       []
101debugValueSubstitutions: []
102constants:       []
103machineFunctionInfo: {}
104body:             |
105  ; CHECK-LABEL: name: widget
106  ; CHECK: bb.0.bb:
107  ; CHECK-NEXT:   successors: %bb.1(0x80000000)
108  ; CHECK-NEXT:   liveins: $ecx
109  ; CHECK-NEXT: {{  $}}
110  ; CHECK-NEXT:   renamable $al = MOV8ri 1, implicit-def $eax
111  ; CHECK-NEXT: {{  $}}
112  ; CHECK-NEXT: bb.1.bb1 (align 16):
113  ; CHECK-NEXT:   successors: %bb.1(0x7c000000), %bb.2(0x04000000)
114  ; CHECK-NEXT:   liveins: $eax, $ecx
115  ; CHECK-NEXT: {{  $}}
116  ; CHECK-NEXT:   TEST8ri renamable $al, 1, implicit-def $eflags, implicit killed $eax
117  ; CHECK-NEXT:   renamable $eax = MOV32ri 0
118  ; CHECK-NEXT:   JCC_1 %bb.1, 5, implicit $eflags
119  ; CHECK-NEXT: {{  $}}
120  ; CHECK-NEXT: bb.2.bb3:
121  ; CHECK-NEXT:   RET32
122  ; CHECK-NEXT: {{  $}}
123  ; CHECK-NEXT: bb.3.bb5:
124  ; CHECK-NEXT:   successors: %bb.3(0x80000000)
125  ; CHECK-NEXT:   liveins: $eax, $ecx, $xmm0, $xmm1
126  ; CHECK-NEXT: {{  $}}
127  ; CHECK-NEXT:   renamable $edx = nofpexcept CVTTSD2SIrr killed renamable $xmm1, implicit $mxcsr
128  ; CHECK-NEXT:   CMP32rr renamable $edx, renamable $ecx, implicit-def $eflags
129  ; CHECK-NEXT:   renamable $edx = CMOV32rr killed renamable $edx, renamable $eax, 13, implicit killed $eflags
130  ; CHECK-NEXT:   renamable $xmm2 = CVTSI2SDrr killed renamable $edx
131  ; CHECK-NEXT:   renamable $xmm1 = XORPSrr undef $xmm1, undef $xmm1
132  ; CHECK-NEXT:   renamable $xmm1 = nofpexcept SUBSDrr killed renamable $xmm1, killed renamable $xmm2, implicit $mxcsr
133  ; CHECK-NEXT:   renamable $xmm1 = nofpexcept MULSDrr killed renamable $xmm1, renamable $xmm0, implicit $mxcsr
134  ; CHECK-NEXT:   JMP_1 %bb.3
135  bb.0.bb:
136    successors: %bb.1(0x80000000)
137    liveins: $ecx
138
139    renamable $al = MOV8ri 1, implicit-def $eax
140
141  bb.1.bb1 (align 16):
142    successors: %bb.1(0x7c000000), %bb.2(0x04000000)
143    liveins: $eax, $ecx
144
145    TEST8ri renamable $al, 1, implicit-def $eflags, implicit killed $eax
146    renamable $eax = MOV32ri 0
147    JCC_1 %bb.1, 5, implicit $eflags
148
149  bb.2.bb3:
150    RET32
151
152  bb.3.bb5:
153    successors: %bb.3(0x80000000)
154    liveins: $eax, $ecx, $xmm0, $xmm1
155
156    renamable $edx = nofpexcept CVTTSD2SIrr killed renamable $xmm1, implicit $mxcsr
157    CMP32rr renamable $edx, renamable $ecx, implicit-def $eflags
158    renamable $edx = CMOV32rr killed renamable $edx, renamable $eax, 13, implicit killed $eflags
159    renamable $xmm2 = CVTSI2SDrr killed renamable $edx
160    renamable $xmm1 = XORPSrr undef $xmm1, undef $xmm1
161    renamable $xmm1 = nofpexcept SUBSDrr killed renamable $xmm1, killed renamable $xmm2, implicit $mxcsr
162    renamable $xmm1 = nofpexcept MULSDrr killed renamable $xmm1, renamable $xmm0, implicit $mxcsr
163    JMP_1 %bb.3
164
165...
166