File: coalescer-removepartial-extend-undef-subrange.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 (83 lines) | stat: -rw-r--r-- 2,881 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
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -march=amdgcn -mcpu=gfx900 -run-pass register-coalescer -verify-machineinstrs -o - %s | FileCheck %s
#
# The failure occurs when the coalescer tries to removePartialRedundency() on the
# "%2:vreg_64 = COPY %3" in bb.1. The coalescer tries to prune and extend each
# subrange of %2, the subrange for %2.sub1 has a def location (in bb.2) in the
# predecessor path 2->3->1. But for another predecessor path 0->4->1,
# the subrange has only one undef location in bb.0. If we don't compute Undef set,
# it will fail to find the reaching def for %2.sub1 in predecessor bb.4 and bb.0
# and crash with error message:
# "Use of $noreg does not have a corresponding definition on every path
#  LLVM ERROR: Use not jointly dominated by defs"

---
name:            _amdgpu_ps_main
alignment:       1
tracksRegLiveness: true
body:             |
  ; CHECK-LABEL: name: _amdgpu_ps_main
  ; CHECK: bb.0:
  ; CHECK-NEXT:   successors: %bb.2(0x40000000), %bb.4(0x40000000)
  ; CHECK-NEXT:   liveins: $sgpr2, $sgpr3, $vgpr3
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   [[COPY:%[0-9]+]]:sgpr_32 = COPY $sgpr2
  ; CHECK-NEXT:   undef %1.sub0:vreg_64 = COPY [[COPY]]
  ; CHECK-NEXT:   undef %2.sub0:vreg_64 = COPY [[COPY]]
  ; CHECK-NEXT:   S_CBRANCH_VCCNZ %bb.2, implicit undef $vcc
  ; CHECK-NEXT:   S_BRANCH %bb.4
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.1:
  ; CHECK-NEXT:   successors: %bb.2(0x80000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   S_NOP 0, implicit %2.sub0
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.2:
  ; CHECK-NEXT:   successors: %bb.3(0x04000000), %bb.2(0x7c000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   [[COPY1:%[0-9]+]]:vreg_64 = COPY %2
  ; CHECK-NEXT:   %1.sub0:vreg_64 = COPY [[COPY1]].sub0
  ; CHECK-NEXT:   [[COPY2:%[0-9]+]]:vreg_64 = COPY %1
  ; CHECK-NEXT:   S_CBRANCH_EXECNZ %bb.2, implicit undef $exec
  ; CHECK-NEXT:   S_BRANCH %bb.3
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.3:
  ; CHECK-NEXT:   successors: %bb.1(0x80000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   [[COPY3:%[0-9]+]]:vreg_64 = COPY [[COPY1]]
  ; CHECK-NEXT:   S_BRANCH %bb.1
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.4:
  ; CHECK-NEXT:   successors: %bb.1(0x80000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   S_BRANCH %bb.1
  bb.0:
    liveins: $sgpr2, $sgpr3, $vgpr3

    %0:sgpr_32 = COPY $sgpr2
    undef %1.sub0:vreg_64 = COPY %0
    undef %2.sub0:vreg_64 = COPY %0
    S_CBRANCH_VCCNZ %bb.2, implicit undef $vcc
    S_BRANCH %bb.4

  bb.1:
    %2:vreg_64 = COPY %3
    S_NOP 0, implicit %2.sub0

  bb.2:
    successors: %bb.3(0x04000000), %bb.2(0x7c000000)

    %3:vreg_64 = COPY %2
    %1.sub0:vreg_64 = COPY %3.sub0
    %2:vreg_64 = COPY %1
    S_CBRANCH_EXECNZ %bb.2, implicit undef $exec
    S_BRANCH %bb.3

  bb.3:
    S_BRANCH %bb.1

  bb.4:
    %3:vreg_64 = COPY %2
    S_BRANCH %bb.1

...