Skip to content

Commit 079d7b6

Browse files
committed
[MCP] Disable BackwardCopyPropagateBlock for copies with implicit registers.
If there's an implicit-def of a super register, the propagation must preserve this implicit-def. Knowing how and when to do this may require target specific knowledge so just disable it for now. Prior to e17f07c, we checked that the copy had explicit 2 operands when that was removed we started allowing implicit operands through. This patch adds a check for implicit operands, but still allows extra explicit operands which was the goal of e17f07c. Fixes #137667.
1 parent 1f504c6 commit 079d7b6

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

llvm/lib/CodeGen/MachineCopyPropagation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1200,7 +1200,7 @@ void MachineCopyPropagation::BackwardCopyPropagateBlock(
12001200
// Ignore non-trivial COPYs.
12011201
std::optional<DestSourcePair> CopyOperands =
12021202
isCopyInstr(MI, *TII, UseCopyInstr);
1203-
if (CopyOperands) {
1203+
if (CopyOperands && MI.getNumImplicitOperands() == 0) {
12041204
Register DefReg = CopyOperands->Destination->getReg();
12051205
Register SrcReg = CopyOperands->Source->getReg();
12061206

llvm/test/CodeGen/SystemZ/pr137667.mir

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ tracksDebugUserValues: true
1212
body: |
1313
bb.0:
1414
; CHECK-LABEL: name: t
15-
; CHECK: renamable $r12d = LLILL 0
15+
; CHECK: renamable $r14d = LLILL 0
16+
; CHECK-NEXT: renamable $r12d = COPY killed renamable $r14d, implicit-def $r12q
1617
; CHECK-NEXT: Return implicit $r12q
1718
renamable $r14d = LLILL 0
1819
renamable $r12d = COPY killed renamable $r14d, implicit-def $r12q

0 commit comments

Comments
 (0)