[PATCH] D80467: [GlobalISel][InlineAsm] Add missing EarlyClobber flag to inline asm output operands
Konstantin Schwarz via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat May 23 05:47:53 PDT 2020
kschwarz created this revision.
kschwarz added reviewers: arsenm, leonardchan.
Herald added subscribers: hiraditya, rovka, wdng.
Herald added a project: LLVM.
Previously, we only added early-clobber flags to the 'group' immediate flag operand
of an inline asm operand.
However, we also have to add the EarlyClobber flag to the MachineOperand itself.
This fixes PR46028
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D80467
Files:
llvm/lib/CodeGen/GlobalISel/InlineAsmLowering.cpp
llvm/test/CodeGen/AArch64/GlobalISel/irtranslator-inline-asm.ll
Index: llvm/test/CodeGen/AArch64/GlobalISel/irtranslator-inline-asm.ll
===================================================================
--- llvm/test/CodeGen/AArch64/GlobalISel/irtranslator-inline-asm.ll
+++ llvm/test/CodeGen/AArch64/GlobalISel/irtranslator-inline-asm.ll
@@ -23,6 +23,22 @@
ret void
}
+define i64 @asm_register_early_clobber() {
+ ; CHECK-LABEL: name: asm_register_early_clobber
+ ; CHECK: bb.1 (%ir-block.0):
+ ; CHECK: INLINEASM &"mov $0, 7; mov $1, 7", 1 /* sideeffect attdialect */, 1441803 /* regdef-ec:GPR64common */, def early-clobber %0, 1441803 /* regdef-ec:GPR64common */, def early-clobber %1, !0
+ ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY %0
+ ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY %1
+ ; CHECK: [[ADD:%[0-9]+]]:_(s64) = G_ADD [[COPY]], [[COPY1]]
+ ; CHECK: $x0 = COPY [[ADD]](s64)
+ ; CHECK: RET_ReallyLR implicit $x0
+ call { i64, i64 } asm sideeffect "mov $0, 7; mov $1, 7", "=&r,=&r"(), !srcloc !0
+ %asmresult = extractvalue { i64, i64 } %1, 0
+ %asmresult1 = extractvalue { i64, i64 } %1, 1
+ %add = add i64 %asmresult, %asmresult1
+ ret i64 %add
+}
+
define i32 @test_specific_register_output() nounwind ssp {
; CHECK-LABEL: name: test_specific_register_output
; CHECK: bb.1.entry:
Index: llvm/lib/CodeGen/GlobalISel/InlineAsmLowering.cpp
===================================================================
--- llvm/lib/CodeGen/GlobalISel/InlineAsmLowering.cpp
+++ llvm/lib/CodeGen/GlobalISel/InlineAsmLowering.cpp
@@ -379,7 +379,8 @@
for (Register Reg : OpInfo.Regs) {
Inst.addReg(Reg,
- RegState::Define | getImplRegState(Reg.isPhysical()));
+ RegState::Define | getImplRegState(Reg.isPhysical()) |
+ (OpInfo.isEarlyClobber ? RegState::EarlyClobber : 0));
}
// Remember this output operand for later processing
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80467.265851.patch
Type: text/x-patch
Size: 1901 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200523/325b3d7b/attachment-0001.bin>
More information about the llvm-commits
mailing list