forked from OSchip/llvm-project
[asm] Correctly handle special names in variants
There's really no reason why anyone should use these special names in a variant. I noticed this while reading the code: all other writes to OS are guarded by this conditional, and the behavior with the check seems more correct, so let's add the check. Differential Revision: https://reviews.llvm.org/D113909
This commit is contained in:
parent
f50c6c1718
commit
833393e021
|
@ -351,9 +351,10 @@ static void EmitGCCInlineAsmStr(const char *AsmStr, const MachineInstr *MI,
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue