File: addrmode-opt-nonreaching.mir

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.8-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,696 kB
  • sloc: cpp: 7,438,781; ansic: 1,393,871; asm: 1,012,926; python: 241,771; f90: 86,635; objc: 75,411; lisp: 42,144; pascal: 17,286; sh: 8,596; ml: 5,082; perl: 4,730; makefile: 3,591; awk: 3,523; javascript: 2,251; xml: 892; fortran: 672
file content (233 lines) | stat: -rw-r--r-- 9,771 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# It is not safe to make the transformation if the definition is killed by a call.
# Use debug output for simplicity and test resilience.
#
# RUN: llc -mtriple=hexagon -run-pass amode-opt %s -print-after-all -o %t_1.mir 2>&1 | FileCheck %s
# CHECK: bb.4.if.else
# CHECK-NOT: liveins: $r2
--- |
  ; ModuleID = 'foo.reduced.i'
  source_filename = "foo.reduced.i"
  target datalayout = "e-m:e-p:32:32:32-a:0-n16:32-i64:64:64-i32:32:32-i16:16:16-i1:8:8-f32:32:32-f64:64:64-v32:32:32-v64:64:64-v512:512:512-v1024:1024:1024-v2048:2048:2048"
  target triple = "hexagon-unknown-unknown-elf"

  %struct.struct_1 = type { i8, i8, [7 x %struct.struct_3] }
  %struct.struct_3 = type { i8, %struct.struct_4 }
  %struct.struct_4 = type { i32, i32 }
  %struct.struct_2 = type { i32, i32 }

  ; Function Attrs: nounwind
  define dso_local zeroext i8 @fun_4(i32 noundef %arg_1, i8 noundef zeroext %arg_2, ptr nocapture noundef readonly %arg_3, ptr nocapture noundef readonly %arg_4) local_unnamed_addr #0 {
  entry:
    %conv = zext i8 %arg_2 to i32
    %cmp = icmp ult i8 %arg_2, 7
    br i1 %cmp, label %if.then, label %if.end

  if.then:                                          ; preds = %entry
    tail call void @fun_2(ptr noundef null, i32 noundef %conv) #3
    unreachable

  if.end:                                           ; preds = %entry
    %cgep = getelementptr inbounds %struct.struct_1, ptr %arg_3, i32 0, i32 2, i32 %conv
    %cgep23 = getelementptr inbounds %struct.struct_3, ptr %cgep, i32 0, i32 1, i32 1
    %0 = load i32, ptr %cgep23, align 4
    %cmp3 = icmp eq i32 %0, 4
    br i1 %cmp3, label %land.lhs.true, label %if.else

  land.lhs.true:                                    ; preds = %if.end
    %cgep22 = getelementptr inbounds %struct.struct_3, ptr %cgep, i32 0, i32 1
    %1 = load i32, ptr %cgep22, align 4
    %call = tail call zeroext i8 @fun_5(i32 noundef %arg_1, i32 noundef %1) #4
    %tobool.not = icmp eq i8 %call, 0
    br i1 %tobool.not, label %if.else, label %if.end12

  if.else:                                          ; preds = %land.lhs.true, %if.end
    %2 = load i8, ptr %cgep, align 4
    %cmp.i = icmp eq i8 %2, 1
    br i1 %cmp.i, label %if.then.i, label %fun_3.exit

  if.then.i:                                        ; preds = %if.else
    %cgep2027 = bitcast ptr %arg_4 to ptr
    %cgep26 = getelementptr inbounds %struct.struct_2, ptr %cgep2027, i32 0, i32 1
    %3 = load i32, ptr %cgep26, align 4
    %call.i = tail call i32 @fun_1(i32 noundef %arg_1) #4
    %cmp2.i = icmp ult i32 %3, %call.i
    %cgep25 = getelementptr inbounds %struct.struct_2, ptr %cgep2027, i32 0, i32 1
    %4 = load i32, ptr %cgep25, align 4
    %call6.i = tail call i32 @fun_1(i32 noundef %arg_1) #4
    %cmp7.i = icmp ult i32 %4, %call6.i
    %5 = select i1 %cmp2.i, i1 true, i1 %cmp7.i
    br label %fun_3.exit

  fun_3.exit:                                       ; preds = %if.else, %if.then.i
    %resume_ttl.1.i = phi i1 [ false, %if.else ], [ %5, %if.then.i ]
    %conv15.i = zext i1 %resume_ttl.1.i to i8
    br label %if.end12

  if.end12:                                         ; preds = %land.lhs.true, %fun_3.exit
    %resume_loops.0 = phi i8 [ %conv15.i, %fun_3.exit ], [ 1, %land.lhs.true ]
    ret i8 %resume_loops.0
  }

  ; Function Attrs: noreturn
  declare dso_local void @fun_2(ptr noundef, i32 noundef) local_unnamed_addr #1

  declare dso_local zeroext i8 @fun_5(i32 noundef, i32 noundef) local_unnamed_addr #2

  declare dso_local i32 @fun_1(i32 noundef) local_unnamed_addr #2

  !llvm.module.flags = !{!0, !1}
  !llvm.ident = !{!2}

  !0 = !{i32 1, !"wchar_size", i32 4}
  !1 = !{i32 7, !"frame-pointer", i32 2}
  !2 = !{!""}

...
---
name:            fun_4
alignment:       16
exposesReturnsTwice: false
legalized:       false
regBankSelected: false
selected:        false
failedISel:      false
tracksRegLiveness: true
hasWinCFI:       false
callsEHReturn:   false
callsUnwindInit: false
hasEHCatchret:   false
hasEHScopes:     false
hasEHFunclets:   false
isOutlined:      false
debugInstrRef:   false
failsVerification: false
tracksDebugUserValues: true
registers:       []
liveins:
  - { reg: '$r0', virtual-reg: '' }
  - { reg: '$r1', virtual-reg: '' }
  - { reg: '$r2', virtual-reg: '' }
  - { reg: '$r3', virtual-reg: '' }
frameInfo:
  isFrameAddressTaken: false
  isReturnAddressTaken: false
  hasStackMap:     false
  hasPatchPoint:   false
  stackSize:       0
  offsetAdjustment: 0
  maxAlignment:    4
  adjustsStack:    false
  hasCalls:        true
  stackProtector:  ''
  functionContext: ''
  maxCallFrameSize: 4294967295
  cvBytesOfCalleeSavedRegisters: 0
  hasOpaqueSPAdjustment: false
  hasVAStart:      false
  hasMustTailInVarArgFunc: false
  hasTailCall:     false
  localFrameSize:  0
  savePoint:       ''
  restorePoint:    ''
fixedStack:      []
stack:
  - { id: 0, name: '', type: spill-slot, offset: 0, size: 4, alignment: 4,
      stack-id: default, callee-saved-register: '', callee-saved-restored: true,
      debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
entry_values:    []
callSites:       []
debugValueSubstitutions: []
constants:       []
machineFunctionInfo: {}
body:             |
  bb.0.entry:
    successors: %bb.1(0x00000800), %bb.2(0x7ffff800)
    liveins: $r0:0x0000000000000001, $r1:0x0000000000000001, $r2:0x0000000000000001, $r3:0x0000000000000001

    renamable $p0 = C2_cmpgtui renamable $r1, 6
    renamable $r16 = COPY killed $r3
    renamable $r17 = COPY killed $r0
    J2_jumpt killed renamable $p0, %bb.2, implicit-def dead $pc
    J2_jump %bb.1, implicit-def dead $pc

  bb.1.if.then:
    successors:
    liveins: $r1:0x0000000000000001

    $r0 = A2_tfrsi 0
    ADJCALLSTACKDOWN 0, 0, implicit-def $r29, implicit-def dead $r30, implicit killed $r31, implicit killed $r30, implicit $r29
    PS_call_nr @fun_2, hexagoncsr, implicit killed $r0, implicit killed $r1, implicit-def $r29
    ADJCALLSTACKUP 0, 0, implicit-def dead $r29, implicit-def dead $r30, implicit-def dead $r31, implicit killed $r29

  bb.2.if.end:
    successors: %bb.3(0x40000000), %bb.4(0x40000000)
    liveins: $r1:0x0000000000000001, $r2:0x0000000000000001, $r16:0x0000000000000001, $r17:0x0000000000000001

    renamable $r2 = M2_macsip killed renamable $r2, killed renamable $r1, 12
    renamable $r3 = L2_loadri_io renamable $r2, 12 :: (load (s32) from %ir.cgep23)
    renamable $p0 = C2_cmpeqi killed renamable $r3, 4
    renamable $r18 = A2_addi killed renamable $r2, 4
    J2_jumpf killed renamable $p0, %bb.4, implicit-def dead $pc
    J2_jump %bb.3, implicit-def dead $pc

  bb.3.land.lhs.true:
    successors: %bb.4(0x30000000), %bb.8(0x50000000)
    liveins: $r16:0x0000000000000001, $r17:0x0000000000000001, $r18:0x0000000000000001

    renamable $r1 = L2_loadri_io renamable $r18, 4 :: (load (s32) from %ir.cgep22)
    ADJCALLSTACKDOWN 0, 0, implicit-def $r29, implicit-def dead $r30, implicit killed $r31, implicit killed $r30, implicit $r29
    $r0 = COPY renamable $r17
    J2_call @fun_5, hexagoncsr, implicit-def dead $pc, implicit-def dead $r31, implicit $r29, implicit $r0, implicit killed $r1, implicit-def $r29, implicit-def $r0
    renamable $p0 = C2_cmpeqi killed renamable $r0, 0
    ADJCALLSTACKUP 0, 0, implicit-def dead $r29, implicit-def dead $r30, implicit-def dead $r31, implicit killed $r29
    renamable $r0 = A2_tfrsi 1
    J2_jumpf killed renamable $p0, %bb.8, implicit-def dead $pc
    J2_jump %bb.4, implicit-def dead $pc

  bb.4.if.else:
    successors: %bb.6(0x40000000), %bb.5(0x40000000)
    liveins: $r16:0x0000000000000001, $r17:0x0000000000000001, $r18:0x0000000000000001

    renamable $r2 = L2_loadrb_io killed renamable $r18, 0 :: (load (s8) from %ir.cgep, align 4)
    renamable $p0 = C2_cmpeqi killed renamable $r2, 1
    J2_jumpt killed renamable $p0, %bb.6, implicit-def $pc

  bb.5:
    successors: %bb.7(0x80000000)

    renamable $p0 = PS_false
    J2_jump %bb.7, implicit-def $pc

  bb.6.if.then.i:
    successors: %bb.7(0x80000000)
    liveins: $r16:0x0000000000000001, $r17:0x0000000000000001

    ADJCALLSTACKDOWN 0, 0, implicit-def $r29, implicit-def dead $r30, implicit $r31, implicit $r30, implicit $r29
    $r0 = COPY renamable $r17
    renamable $r18 = L2_loadri_io renamable $r16, 4 :: (load (s32) from %ir.cgep26)
    J2_call @fun_1, hexagoncsr, implicit-def dead $pc, implicit-def dead $r31, implicit $r29, implicit $r0, implicit-def $r29, implicit-def $r0
    ADJCALLSTACKUP 0, 0, implicit-def dead $r29, implicit-def dead $r30, implicit-def dead $r31, implicit $r29
    renamable $p0 = C2_cmpgtu killed renamable $r0, killed renamable $r18
    STriw_pred %stack.0, 0, killed renamable $p0 :: (store (s32) into %stack.0)
    $r0 = COPY killed renamable $r17
    ADJCALLSTACKDOWN 0, 0, implicit-def $r29, implicit-def dead $r30, implicit killed $r31, implicit killed $r30, implicit $r29
    renamable $r16 = L2_loadri_io killed renamable $r16, 4 :: (load (s32) from %ir.cgep25)
    J2_call @fun_1, hexagoncsr, implicit-def dead $pc, implicit-def dead $r31, implicit $r29, implicit $r0, implicit-def $r29, implicit-def $r0
    renamable $p0 = C2_cmpgtu killed renamable $r0, killed renamable $r16
    ADJCALLSTACKUP 0, 0, implicit-def dead $r29, implicit-def dead $r30, implicit-def dead $r31, implicit killed $r29
    renamable $p1 = LDriw_pred %stack.0, 0 :: (load (s32) from %stack.0)
    renamable $p0 = C2_or killed renamable $p1, killed renamable $p0

  bb.7.fun_3.exit:
    successors: %bb.8(0x80000000)
    liveins: $p0

    renamable $r0 = C2_cmoveit renamable $p0, 1
    renamable $r0 = C2_cmoveif killed renamable $p0, 0, implicit killed renamable $r0(tied-def 0)

  bb.8.if.end12:
    liveins: $r0:0x0000000000000001

    PS_jmpret killed $r31, implicit-def dead $pc, implicit killed $r0

...