Files
clang-p2996/llvm/test/CodeGen/ARM/pr60908.mir
Sergei Barannikov 1f5e9a3502 [MCP] Do not try forward non-existent sub-register of a copy
In this example:
```
$d14 = COPY killed $d18
$s0 = MI $s28
```

$s28 is a sub-register of $d14. However, $d18 does not have
sub-registers and thus cannot be forwarded. Previously, this resulted
in $noreg being substituted in place of the use of $s28, which later
led to an assertion failure.

Fixes https://github.com/llvm/llvm-project/issues/60908, a regression
that was introduced in D141747.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D146930
2023-03-30 06:11:00 +03:00

46 lines
1.3 KiB
YAML

# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 2
# RUN: llc -mtriple=armv7 -run-pass=machine-cp %s -o - | FileCheck %s
# Positive test: $d15 has sub-register $s30, which should be propagated.
---
name: test_d15
tracksRegLiveness: true
liveins:
- { reg: '$d15' }
body: |
bb.0.entry:
liveins: $d15
; CHECK-LABEL: name: test_d15
; CHECK: liveins: $d15
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: $s0 = COPY $s30
; CHECK-NEXT: BX_RET 14 /* CC::al */, $noreg, implicit killed $s0
renamable $d14 = COPY killed $d15
$s0 = COPY killed renamable $s28
BX_RET 14 /* CC::al */, $noreg, implicit killed $s0
...
# Negative test: $d18 does not have sub-registers.
---
name: test_d18
tracksRegLiveness: true
liveins:
- { reg: '$d18' }
body: |
bb.0.entry:
liveins: $d18
; CHECK-LABEL: name: test_d18
; CHECK: liveins: $d18
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: renamable $d14 = COPY killed $d18
; CHECK-NEXT: $s0 = COPY killed renamable $s28
; CHECK-NEXT: BX_RET 14 /* CC::al */, $noreg, implicit killed $s0
renamable $d14 = COPY killed $d18
$s0 = COPY killed renamable $s28
BX_RET 14 /* CC::al */, $noreg, implicit killed $s0
...