[PATCH] D121691: [AMDGPU] Fix kill flag state for replaced operands
David Stuttard via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 15 06:01:44 PDT 2022
dstuttard created this revision.
Herald added subscribers: foad, kerbowa, hiraditya, t-tye, tpr, yaxunl, nhaehnle, jvesely, kzhuravl, arsenm.
Herald added a project: All.
dstuttard requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.
When copying operands as part of this optimsation, use the kill flag for the
replaced operand, rather than just the From operand.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D121691
Files:
llvm/lib/Target/AMDGPU/SIPeepholeSDWA.cpp
Index: llvm/lib/Target/AMDGPU/SIPeepholeSDWA.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/SIPeepholeSDWA.cpp
+++ llvm/lib/Target/AMDGPU/SIPeepholeSDWA.cpp
@@ -242,13 +242,14 @@
#endif
-static void copyRegOperand(MachineOperand &To, const MachineOperand &From) {
+static void copyRegOperand(MachineOperand &To, const MachineOperand &From,
+ const MachineOperand &Replaced) {
assert(To.isReg() && From.isReg());
To.setReg(From.getReg());
To.setSubReg(From.getSubReg());
To.setIsUndef(From.isUndef());
if (To.isUse()) {
- To.setIsKill(From.isKill());
+ To.setIsKill(Replaced.isKill());
} else {
To.setIsDead(From.isDead());
}
@@ -401,7 +402,7 @@
assert(isSameReg(*Src, *getReplacedOperand()) &&
(IsPreserveSrc || (SrcSel && SrcMods)));
}
- copyRegOperand(*Src, *getTargetOperand());
+ copyRegOperand(*Src, *getTargetOperand(), *getReplacedOperand());
if (!IsPreserveSrc) {
SrcSel->setImm(getSrcSel());
SrcMods->setImm(getSrcMods(TII, Src));
@@ -445,7 +446,7 @@
assert(Operand &&
Operand->isReg() &&
isSameReg(*Operand, *getReplacedOperand()));
- copyRegOperand(*Operand, *getTargetOperand());
+ copyRegOperand(*Operand, *getTargetOperand(), *getReplacedOperand());
MachineOperand *DstSel= TII->getNamedOperand(MI, AMDGPU::OpName::dst_sel);
assert(DstSel);
DstSel->setImm(getDstSel());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121691.415401.patch
Type: text/x-patch
Size: 1468 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220315/68cece7c/attachment.bin>
More information about the llvm-commits
mailing list