[PATCH] D110848: [TwoAddressInstruction] Fix ReplacedAllUntiedUses in processTiedPairs
Jay Foad via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 30 09:39:04 PDT 2021
foad created this revision.
Herald added subscribers: mstorsjo, hiraditya.
foad requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Fix the calculation of ReplacedAllUntiedUses when any of the tied defs
are early-clobber. The effect of this is to fix the placement of kill
flags on an instruction like this (from @f2 in
test/CodeGen/SystemZ/asm-18.ll):
INLINEASM &"stepb $1, $2" [attdialect], $0:[regdef-ec:GRH32Bit], def early-clobber %3:grh32bit, $1:[reguse tiedto:$0], killed %4:grh32bit(tied-def 3), $2:[reguse:GRH32Bit], %4:grh32bit
After TwoAddressInstruction without this patch:
%3:grh32bit = COPY killed %4:grh32bit
INLINEASM &"stepb $1, $2" [attdialect], $0:[regdef-ec:GRH32Bit], def early-clobber %3:grh32bit, $1:[reguse tiedto:$0], %3:grh32bit(tied-def 3), $2:[reguse:GRH32Bit], %4:grh32bit
Note that the COPY kills %4, even though there is a later use of %4 in
the INLINEASM. This fails machine verification if you force it to run
after TwoAddressInstruction (currently it is disabled for other
reasons).
After TwoAddressInstruction with this patch:
%3:grh32bit = COPY %4:grh32bit
INLINEASM &"stepb $1, $2" [attdialect], $0:[regdef-ec:GRH32Bit], def early-clobber %3:grh32bit, $1:[reguse tiedto:$0], %3:grh32bit(tied-def 3), $2:[reguse:GRH32Bit], %4:grh32bit
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D110848
Files:
llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
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.376250.patch
Type: text/x-patch
Size: 650 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210930/fb0df512/attachment.bin>
More information about the llvm-commits
mailing list