File: branch-folder-hoist-kills.mir

package info (click to toggle)
llvm-toolchain-14 1%3A14.0.6-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,496,180 kB
  • sloc: cpp: 5,593,972; ansic: 986,872; asm: 585,869; python: 184,223; objc: 72,530; lisp: 31,119; f90: 27,793; javascript: 9,780; pascal: 9,762; sh: 9,482; perl: 7,468; ml: 5,432; awk: 3,523; makefile: 2,538; xml: 953; cs: 573; fortran: 567
file content (59 lines) | stat: -rw-r--r-- 1,751 bytes parent folder | download | duplicates (22)
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
# RUN: llc -march=hexagon -run-pass branch-folder -run-pass if-converter -verify-machineinstrs %s -o - | FileCheck %s

# The hoisting of common instructions from successors could cause registers
# to no longer be live-in in the successor blocks. The liveness was updated
# to include potential new live-in registres, but not to remove registers
# that were no longer live-in.
# This could cause if-converter to generate incorrect code.
#
# In this testcase, the "r1 = A2_sxth killed r0" was hoisted, and since r0
# was killed, it was no longer live-in in either successor. The if-converter
# then created code, where the first predicated instruction has incorrect
# implicit use of r0:
#
# %bb.0:
#     liveins: %r0
#         %r1 = A2_sxth killed %r0               ; hoisted, kills r0
#         A2_nop implicit-def %P0
#         %r0 = C2_cmoveit %P0, 2, implicit %r0 ; predicated A2_tfrsi
#         %r0 = C2_cmoveif killed %P0, 1, implicit %r0 ; predicated A2_tfrsi
#         %r0 = A2_add killed %r0, killed %r1
#         J2_jumpr %r31, implicit dead %PC
#

# CHECK: $r1 = A2_sxth killed $r0
# CHECK: $r0 = C2_cmoveit $p0, 2
# CHECK-NOT: implicit-def $r0
# CHECK: $r0 = C2_cmoveif killed $p0, 1, implicit killed $r0

---
name: fred
tracksRegLiveness: true

body: |
  bb.0:
    liveins: $r0
    successors: %bb.1, %bb.2

    A2_nop implicit-def $p0
    J2_jumpt killed $p0, %bb.2, implicit-def dead $pc

  bb.1:
    successors: %bb.3
    liveins: $r0
    $r1 = A2_sxth killed $r0
    $r0 = A2_tfrsi 1
    J2_jump %bb.3, implicit-def $pc

  bb.2:
    successors: %bb.3
    liveins: $r0
    $r1 = A2_sxth killed $r0
    $r0 = A2_tfrsi 2

  bb.3:
    liveins: $r0, $r1
    $r0 = A2_add killed $r0, killed $r1
    J2_jumpr $r31, implicit-def dead $pc
...