Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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 #60908, a regression that was introduced in D141747. Reviewed By: arsenm Differential Revision: https://reviews.llvm.org/D146930
- Loading branch information
1 parent
50f2ce4
commit 1f5e9a3
Showing
2 changed files
with
58 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# 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 | ||
... |