• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# RUN: llc -march=hexagon -run-pass branch-folder %s -o - -verify-machineinstrs | FileCheck %s
2
3# Branch folding will perform tail merging of bb.1 and bb.2, and bb.2 will
4# become the common tail. The use of R0 in bb.2 is <undef> while the
5# corresponding use in bb.1 is not. The common tail will have the <undef>
6# flag removed, which will cause R0 to become a live-in to bb.2. The problem
7# is that R0 is not live-out from all predecessors of bb.2, namely is not
8# live-out from bb.0. To remedy that, the branch folder should add an
9# IMPLICIT_DEF to that block.
10
11# CHECK-LABEL: name: func0
12# CHECK-LABEL: bb.0:
13# CHECK: $r0 = IMPLICIT_DEF
14# CHECK-LABEL: bb.1:
15# CHECK-LABEL: bb.2:
16# CHECK: liveins: $r0
17# CHECK: PS_storerhabs 0, $r0
18# CHECK: PS_jmpret
19
20---
21name: func0
22tracksRegLiveness: true
23
24body: |
25  bb.0:
26    liveins: $r31
27    successors: %bb.1, %bb.2
28      J2_jumpt undef $p0, %bb.2, implicit-def $pc
29      J2_jump %bb.1, implicit-def $pc
30
31  bb.1:
32    liveins: $r31
33    successors: %bb.3
34      $r0 = L2_loadruh_io undef $r1, 0
35      PS_storerhabs 0, killed $r0
36      J2_jump %bb.3, implicit-def $pc
37
38  bb.2:
39    liveins: $r31
40    successors: %bb.3
41      PS_storerhabs 0, undef $r0
42      J2_jump %bb.3, implicit-def $pc
43
44  bb.3:
45    liveins: $r31
46      PS_jmpret killed $r31, implicit-def $pc
47...
48---
49# CHECK-LABEL: name: func1
50# CHECK-LABEL: bb.1:
51# CHECK: $r0 = IMPLICIT_DEF
52# CHECK-LABEL: bb.2:
53# CHECK-LABEL: bb.3:
54# CHECK: liveins: $r0
55# CHECK: PS_storerhabs 0, killed $r0
56# CHECK: PS_jmpret
57
58name: func1
59tracksRegLiveness: true
60
61body: |
62  bb.0:
63    liveins: $r31
64    successors: %bb.1, %bb.2
65      J2_jumpt undef $p0, %bb.2, implicit-def $pc
66      J2_jump %bb.1, implicit-def $pc
67
68  bb.1:
69    liveins: $r31
70    successors: %bb.3
71      $r1 = A2_tfrsi 1
72      PS_storerhabs 0, undef $r0
73      $r0 = A2_tfrsi 1
74      J2_jump %bb.3, implicit-def $pc
75
76  bb.2:
77    liveins: $r31
78    successors: %bb.3
79      $r0 = L2_loadruh_io undef $r1, 0
80      PS_storerhabs 0, killed $r0
81      $r0 = A2_tfrsi 1
82      J2_jump %bb.3, implicit-def $pc
83
84  bb.3:
85    liveins: $r31
86      PS_jmpret killed $r31, implicit undef $r0, implicit-def $pc
87...
88