diff options
| -rw-r--r-- | llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp | 11 | ||||
| -rw-r--r-- | llvm/test/MC/ELF/cfi-reg.s | 18 | 
2 files changed, 24 insertions, 5 deletions
diff --git a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp index 8a7d6f0c753..2d787b6a9a9 100644 --- a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp +++ b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp @@ -521,12 +521,13 @@ bool X86AsmParser::isDstOp(X86Operand &Op) {  bool X86AsmParser::ParseRegister(unsigned &RegNo,                                   SMLoc &StartLoc, SMLoc &EndLoc) {    RegNo = 0; -  if (!isParsingIntelSyntax()) { -    const AsmToken &TokPercent = Parser.getTok(); -    assert(TokPercent.is(AsmToken::Percent) && "Invalid token kind!"); -    StartLoc = TokPercent.getLoc(); +  const AsmToken &PercentTok = Parser.getTok(); +  StartLoc = PercentTok.getLoc(); + +  // If we encounter a %, ignore it. This code handles registers with and +  // without the prefix, unprefixed registers can occur in cfi directives. +  if (!isParsingIntelSyntax() && PercentTok.is(AsmToken::Percent))      Parser.Lex(); // Eat percent token. -  }    const AsmToken &Tok = Parser.getTok();    if (Tok.isNot(AsmToken::Identifier)) { diff --git a/llvm/test/MC/ELF/cfi-reg.s b/llvm/test/MC/ELF/cfi-reg.s new file mode 100644 index 00000000000..fd68d6d5ad0 --- /dev/null +++ b/llvm/test/MC/ELF/cfi-reg.s @@ -0,0 +1,18 @@ +// RUN: llvm-mc -triple x86_64-pc-linux-gnu %s -o - | FileCheck %s +// PR13754 + +f: +	.cfi_startproc +        nop +	.cfi_offset 6, -16 +        nop +	.cfi_offset %rsi, -16 +        nop +	.cfi_offset rbx, -16 +        nop +	.cfi_endproc + +// CHECK: f: +// CHECK: .cfi_offset %rbp, -16 +// CHECK: .cfi_offset %rsi, -16 +// CHECK: .cfi_offset %rbx, -16  | 

