File: branchfolder-insert-impdef.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 (87 lines) | stat: -rw-r--r-- 2,140 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
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
# RUN: llc -march=hexagon -run-pass branch-folder %s -o - -verify-machineinstrs | FileCheck %s

# Branch folding will perform tail merging of bb.1 and bb.2, and bb.2 will
# become the common tail. The use of R0 in bb.2 is <undef> while the
# corresponding use in bb.1 is not. The common tail will have the <undef>
# flag removed, which will cause R0 to become a live-in to bb.2. The problem
# is that R0 is not live-out from all predecessors of bb.2, namely is not
# live-out from bb.0. To remedy that, the branch folder should add an
# IMPLICIT_DEF to that block.

# CHECK-LABEL: name: func0
# CHECK-LABEL: bb.0:
# CHECK: $r0 = IMPLICIT_DEF
# CHECK-LABEL: bb.1:
# CHECK-LABEL: bb.2:
# CHECK: liveins: $r0
# CHECK: PS_storerhabs 0, $r0
# CHECK: PS_jmpret

---
name: func0
tracksRegLiveness: true

body: |
  bb.0:
    liveins: $r31
    successors: %bb.1, %bb.2
      J2_jumpt undef $p0, %bb.2, implicit-def $pc
      J2_jump %bb.1, implicit-def $pc

  bb.1:
    liveins: $r31
    successors: %bb.3
      $r0 = L2_loadruh_io undef $r1, 0
      PS_storerhabs 0, killed $r0
      J2_jump %bb.3, implicit-def $pc

  bb.2:
    liveins: $r31
    successors: %bb.3
      PS_storerhabs 0, undef $r0
      J2_jump %bb.3, implicit-def $pc

  bb.3:
    liveins: $r31
      PS_jmpret killed $r31, implicit-def $pc
...
---
# CHECK-LABEL: name: func1
# CHECK-LABEL: bb.1:
# CHECK: $r0 = IMPLICIT_DEF
# CHECK-LABEL: bb.2:
# CHECK-LABEL: bb.3:
# CHECK: liveins: $r0
# CHECK: PS_storerhabs 0, killed $r0
# CHECK: PS_jmpret

name: func1
tracksRegLiveness: true

body: |
  bb.0:
    liveins: $r31
    successors: %bb.1, %bb.2
      J2_jumpt undef $p0, %bb.2, implicit-def $pc
      J2_jump %bb.1, implicit-def $pc

  bb.1:
    liveins: $r31
    successors: %bb.3
      $r1 = A2_tfrsi 1
      PS_storerhabs 0, undef $r0
      $r0 = A2_tfrsi 1
      J2_jump %bb.3, implicit-def $pc

  bb.2:
    liveins: $r31
    successors: %bb.3
      $r0 = L2_loadruh_io undef $r1, 0
      PS_storerhabs 0, killed $r0
      $r0 = A2_tfrsi 1
      J2_jump %bb.3, implicit-def $pc

  bb.3:
    liveins: $r31
      PS_jmpret killed $r31, implicit undef $r0, implicit-def $pc
...