[PATCH] D113909: [asm] Correctly handle special names in variants
Nico Weber via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 15 12:37:40 PST 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rG833393e021dc: [asm] Correctly handle special names in variants (authored by thakis).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D113909/new/
https://reviews.llvm.org/D113909
Files:
llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
llvm/test/CodeGen/Generic/inline-asm-special-strings.ll
Index: llvm/test/CodeGen/Generic/inline-asm-special-strings.ll
===================================================================
--- llvm/test/CodeGen/Generic/inline-asm-special-strings.ll
+++ llvm/test/CodeGen/Generic/inline-asm-special-strings.ll
@@ -1,6 +1,9 @@
-; RUN: llc -no-integrated-as < %s | grep "foo 0 0"
+; RUN: llc -no-integrated-as < %s | FileCheck %s
define void @bar() nounwind {
- tail call void asm sideeffect "foo ${:uid} ${:uid}", ""() nounwind
- ret void
+ ; CHECK: foo 0 0{{$}}
+ tail call void asm sideeffect "foo ${:uid} ${:uid}", ""() nounwind
+ ; CHECK: bar 1 x{{$}}
+ tail call void asm sideeffect "bar $(${:uid} x$| ${:uid} x$)", ""() nounwind
+ ret void
}
Index: llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
+++ llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
@@ -351,9 +351,10 @@
if (!StrEnd)
report_fatal_error("Unterminated ${:foo} operand in inline asm"
" string: '" + Twine(AsmStr) + "'");
-
- std::string Val(StrStart, StrEnd);
- AP->PrintSpecial(MI, OS, Val.c_str());
+ if (CurVariant == -1 || CurVariant == AsmPrinterVariant) {
+ std::string Val(StrStart, StrEnd);
+ AP->PrintSpecial(MI, OS, Val.c_str());
+ }
LastEmitted = StrEnd+1;
break;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113909.387361.patch
Type: text/x-patch
Size: 1448 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211115/3746ab9e/attachment-0001.bin>
More information about the llvm-commits
mailing list