File: verify-inlineasmbr.mir

package info (click to toggle)
llvm-toolchain-17 1%3A17.0.6-22
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,799,624 kB
  • sloc: cpp: 6,428,607; ansic: 1,383,196; asm: 793,408; python: 223,504; objc: 75,364; f90: 60,502; lisp: 33,869; pascal: 15,282; sh: 9,684; perl: 7,453; ml: 4,937; awk: 3,523; makefile: 2,889; javascript: 2,149; xml: 888; fortran: 619; cs: 573
file content (178 lines) | stat: -rw-r--r-- 6,110 bytes parent folder | download | duplicates (5)
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
# RUN: not --crash llc -run-pass=none -verify-machineinstrs %s 2>&1 \
# RUN:  | FileCheck %s
# REQUIRES: powerpc-registered-target

# Test for a case we observed after the initial implementation of D129997
# landed, in which case we observed a crash while building the ppc64le Linux
# kernel. In that case, we had one block with two exits, both to the same
# successor. Removing one of the exits corrupted the successor/predecessor
# lists.

# CHECK: *** Bad machine code: INLINEASM_BR indirect target missing from successor list ***
# CHECK-NEXT: - function:    ceph_con_v2_try_read
# CHECK-NEXT: - basic block: %bb.3 if.else.i.i
# CHECK-NEXT: - instruction: INLINEASM_BR &"" [sideeffect] [attdialect], $0:[imm], %bb.5
# CHECK-NEXT: - operand 3:   %bb.5

# CHECK: *** Bad machine code: INLINEASM_BR indirect target predecessor list missing parent ***
# CHECK-NEXT: - function:    ceph_con_v2_try_read
# CHECK-NEXT: - basic block: %bb.3 if.else.i.i
# CHECK-NEXT: - instruction: INLINEASM_BR &"" [sideeffect] [attdialect], $0:[imm], %bb.5
# CHECK-NEXT: - operand 3:   %bb.5

--- |
  target datalayout = "e-m:e-i64:64-n32:64-S128-v256:256:256-v512:512:512"
  target triple = "powerpc64le-unknown-linux-gnu"

  ; Function Attrs: argmemonly nocallback nofree nosync nounwind willreturn
  declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

  define void @ceph_con_v2_try_read(i32 %__trans_tmp_3.sroa.0.0.copyload, i1 %tobool.not.i.i) {
  entry:
    %skip.i.i = alloca i32, i32 0, align 4
    %cond = icmp eq i32 %__trans_tmp_3.sroa.0.0.copyload, 0
    br label %for.cond

  for.cond:                                         ; preds = %for.cond, %process_message_header.exit.i, %if.end.i, %entry
    br i1 %cond, label %sw.bb, label %for.cond

  sw.bb:                                            ; preds = %for.cond
    %call.i.i2 = call i32 null(ptr %skip.i.i)
    br i1 %tobool.not.i.i, label %if.else.i.i, label %process_message_header.exit.i

  if.else.i.i:                                      ; preds = %sw.bb
    callbr void asm sideeffect "", "!i"()
            to label %if.end.i [label %if.end.i]

  process_message_header.exit.i:                    ; preds = %sw.bb
    call void @llvm.lifetime.end.p0(i64 0, ptr %skip.i.i)
    br label %for.cond

  if.end.i:                                         ; preds = %if.else.i.i, %if.else.i.i
    call void @llvm.lifetime.end.p0(i64 0, ptr %skip.i.i)
    br label %for.cond
  }

  attributes #0 = { argmemonly nocallback nofree nosync nounwind willreturn }

...
---
name:            ceph_con_v2_try_read
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
failsVerification: false
tracksDebugUserValues: false
registers:
  - { id: 0, class: crbitrc, preferred-register: '' }
  - { id: 1, class: g8rc, preferred-register: '' }
  - { id: 2, class: g8rc, preferred-register: '' }
  - { id: 3, class: crbitrc, preferred-register: '' }
  - { id: 4, class: gprc, preferred-register: '' }
  - { id: 5, class: crrc, preferred-register: '' }
  - { id: 6, class: g8rc, preferred-register: '' }
  - { id: 7, class: g8rc, preferred-register: '' }
  - { id: 8, class: g8rc, preferred-register: '' }
  - { id: 9, class: g8rc, preferred-register: '' }
  - { id: 10, class: g8rc, preferred-register: '' }
liveins:
  - { reg: '$x3', virtual-reg: '%1' }
  - { reg: '$x4', virtual-reg: '%2' }
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: skip.i.i, type: default, offset: 0, size: 1, alignment: 4,
      stack-id: default, callee-saved-register: '', callee-saved-restored: true,
      debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
callSites:       []
debugValueSubstitutions: []
constants:       []
machineFunctionInfo: {}
body:             |
  bb.0.entry:
    successors: %bb.1(0x80000000)
    liveins: $x3, $x4

    %2:g8rc = COPY $x4
    %1:g8rc = COPY $x3
    %10:g8rc = ANDI8_rec %2, 1, implicit-def $cr0
    %3:crbitrc = COPY $cr0gt
    %4:gprc = COPY %1.sub_32
    %5:crrc = CMPWI killed %4, 0
    %0:crbitrc = COPY %5.sub_eq

  bb.1.for.cond:
    successors: %bb.2(0x30000000), %bb.1(0x50000000)

    BCn %0, %bb.1
    B %bb.2

  bb.2.sw.bb:
    successors: %bb.3(0x40000000), %bb.4(0x40000000)

    ADJCALLSTACKDOWN 32, 0, implicit-def dead $r1, implicit $r1
    %6:g8rc = COPY $x2
    STD %6, 24, $x1 :: (store (s64) into stack + 24)
    %7:g8rc = ADDI8 %stack.0.skip.i.i, 0
    %8:g8rc = LI8 0
    $x3 = COPY %7
    $x12 = COPY %8
    MTCTR8 %8, implicit-def $ctr8
    BCTRL8_LDinto_toc 24, $x1, csr_ppc64_altivec, implicit-def dead $lr8, implicit-def dead $x2, implicit $ctr8, implicit $rm, implicit $x3, implicit $x12, implicit $x2, implicit-def $r1, implicit-def $x3
    ADJCALLSTACKUP 32, 0, implicit-def dead $r1, implicit $r1
    %9:g8rc = COPY $x3
    BCn %3, %bb.4
    B %bb.3

  ; Oops, should have %bb.5 in the successor list!
  bb.3.if.else.i.i:
    successors: %bb.1(0x80000000)

    INLINEASM_BR &"", 1 /* sideeffect attdialect */, 13 /* imm */, %bb.5
    LIFETIME_END %stack.0.skip.i.i
    B %bb.1

  bb.4.process_message_header.exit.i:
    successors: %bb.1(0x80000000)

    LIFETIME_END %stack.0.skip.i.i
    B %bb.1

  ; Oops, should have %bb.3 in the predecessor list!
  bb.5.if.end.i (machine-block-address-taken, inlineasm-br-indirect-target):
    successors: %bb.1(0x80000000)

    LIFETIME_END %stack.0.skip.i.i
    B %bb.1

...