[PATCH] D125657: [RegisterCoalescer] fix dst subreg replacement during remat copy trick
Quentin Colombet via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 23 12:05:39 PDT 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd2e434c37842: [RegisterCoalescer] fix dst subreg replacement during remat copy trick (authored by ivafanas, committed by qcolombet).
Changed prior to commit:
https://reviews.llvm.org/D125657?vs=429928&id=462569#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D125657/new/
https://reviews.llvm.org/D125657
Files:
llvm/lib/CodeGen/RegisterCoalescer.cpp
Index: llvm/lib/CodeGen/RegisterCoalescer.cpp
===================================================================
--- llvm/lib/CodeGen/RegisterCoalescer.cpp
+++ llvm/lib/CodeGen/RegisterCoalescer.cpp
@@ -1376,8 +1376,18 @@
TRI->getCommonSubClass(DefRC, DstRC);
if (CommonRC != nullptr) {
NewRC = CommonRC;
+
+ // Instruction might contain "undef %0:subreg" as use operand:
+ // %0:subreg = instr op_1, ..., op_N, undef %0:subreg, op_N+2, ...
+ //
+ // Need to check all operands.
+ for (MachineOperand &MO : NewMI.operands()) {
+ if (MO.isReg() && MO.getReg() == DstReg && MO.getSubReg() == DstIdx) {
+ MO.setSubReg(0);
+ }
+ }
+
DstIdx = 0;
- DefMO.setSubReg(0);
DefMO.setIsUndef(false); // Only subregs can have def+undef.
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125657.462569.patch
Type: text/x-patch
Size: 864 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220923/7d7ed8ef/attachment.bin>
More information about the llvm-commits
mailing list