[clang] [llvm] [X86][AsmParser] Fix MS inline asm label mismatch with offset operator (PR #199552)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 3 01:58:44 PDT 2026
================
@@ -2317,8 +2317,12 @@ bool X86AsmParser::ParseIntelInlineAsmIdentifier(
if (!IsParsingOffsetOperator)
InstInfo->AsmRewrites->emplace_back(AOK_Label, Loc, Identifier.size(),
InternalName);
- else
- Identifier = InternalName;
+ else {
+ // When parsing the offset operator, we need to prepend
+ // PrivateLabelPrefix to match the AOK_Label rewrite at label definition.
+ StringRef Prefix = getContext().getAsmInfo().getPrivateLabelPrefix();
+ Identifier = getContext().getOrCreateSymbol(Twine(Prefix) + InternalName)->getName();
----------------
sonyps5201314 wrote:
> getPrivateLabelPrefix should not be used. I'm creating a patch to remove it to finish a migration I started long ago.
Replace with `getInternalSymbolPrefix()`. This is consistent with the API used by the `AOK_Label` rewrite logic ([AsmParser.cpp:6291](https://github.com/llvm/llvm-project/blob/6bfca10b7a9da1b35717f16a820c8e837f87ea17/llvm/lib/MC/MCParser/AsmParser.cpp#L6291)).
https://github.com/llvm/llvm-project/pull/199552
More information about the cfe-commits
mailing list