[PATCH] D110848: [TwoAddressInstruction] Fix ReplacedAllUntiedUses in processTiedPairs
Jay Foad via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 1 11:44:38 PDT 2021
foad updated this revision to Diff 376589.
foad added a comment.
Rebase on a test case that I will pre-commit.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D110848/new/
https://reviews.llvm.org/D110848
Files:
llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
llvm/test/CodeGen/SystemZ/twoaddr-kill.ll
Index: llvm/test/CodeGen/SystemZ/twoaddr-kill.ll
===================================================================
--- llvm/test/CodeGen/SystemZ/twoaddr-kill.ll
+++ llvm/test/CodeGen/SystemZ/twoaddr-kill.ll
@@ -1,8 +1,8 @@
; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
; RUN: llc < %s -verify-machineinstrs -mtriple=s390x-linux-gnu -mcpu=z196 -stop-after=twoaddressinstruction -verify-machineinstrs | FileCheck %s
-; FIXME: The COPY from [[COPY3]] is killed even though there is a subsequent use
-; of [[COPY3]] in the INLINEASM instruction.
+; Check that the COPY from [[COPY3]] is not killed because there is a subsequent
+; use of [[COPY3]] in the INLINEASM instruction.
define i32 @f2(i32 %old) {
; CHECK-LABEL: name: f2
; CHECK: bb.0 (%ir-block.0):
@@ -15,7 +15,7 @@
; CHECK-NEXT: [[COPY2:%[0-9]+]]:grh32bit = COPY killed [[COPY1]]
; CHECK-NEXT: INLINEASM &"stepa $1, $2, $3", 0 /* attdialect */, 393226 /* regdef:GRH32Bit */, def [[COPY2]], 2147483657 /* reguse tiedto:$0 */, [[COPY2]](tied-def 3), 9 /* reguse */, killed $r2l, 9 /* reguse */, killed $r3l
; CHECK-NEXT: [[COPY3:%[0-9]+]]:grh32bit = COPY killed [[COPY2]]
- ; CHECK-NEXT: [[COPY4:%[0-9]+]]:grh32bit = COPY killed [[COPY3]]
+ ; CHECK-NEXT: [[COPY4:%[0-9]+]]:grh32bit = COPY [[COPY3]]
; CHECK-NEXT: INLINEASM &"stepb $1, $2", 0 /* attdialect */, 393227 /* regdef-ec:GRH32Bit */, def early-clobber [[COPY4]], 2147483657 /* reguse tiedto:$0 */, [[COPY4]](tied-def 3), 393225 /* reguse:GRH32Bit */, [[COPY3]]
; CHECK-NEXT: $r2l = COPY killed [[COPY4]]
; CHECK-NEXT: Return implicit killed $r2l
Index: llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
===================================================================
--- llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
+++ llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
@@ -1486,9 +1486,10 @@
}
if (AllUsesCopied) {
- bool ReplacedAllUntiedUses = true;
+ bool ReplacedAllUntiedUses = false;
if (!IsEarlyClobber) {
// Replace other (un-tied) uses of regB with LastCopiedReg.
+ ReplacedAllUntiedUses = true;
for (MachineOperand &MO : MI->operands()) {
if (MO.isReg() && MO.getReg() == RegB && MO.isUse()) {
if (MO.getSubReg() == SubRegB) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110848.376589.patch
Type: text/x-patch
Size: 2291 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211001/ada9343f/attachment.bin>
More information about the llvm-commits
mailing list