[all-commits] [llvm/llvm-project] 4f9a5c: [asm] Remove explicit branch for modifier 'l'

Nico Weber via All-commits all-commits at lists.llvm.org
Fri Nov 19 06:20:09 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4f9a5c2a1438c719f30f384c6bd9ac9290b882c0
      https://github.com/llvm/llvm-project/commit/4f9a5c2a1438c719f30f384c6bd9ac9290b882c0
  Author: Nico Weber <thakis at chromium.org>
  Date:   2021-11-19 (Fri, 19 Nov 2021)

  Changed paths:
    M llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
    M llvm/lib/Target/AVR/AVRAsmPrinter.cpp
    A llvm/test/CodeGen/AVR/inline-asm/inline-asm-invalid.ll

  Log Message:
  -----------
  [asm] Remove explicit branch for modifier 'l'

No intended behavior change.

EmitGCCInlineAsmStr() used to explicitly check for modifier 'l'
after handling block address and machine basic block operands.
This prevented passing a MachineOperand with 'l' modifier to
PrintAsmMemoryOperand(). Conceptually that seems kind of nice,
but in practice the overrides of PrintAsmMemoryOperand() in all (*)
AsmPrinter subclasses already reject modifiers they don't know about,
and none of them don't know about 'l'. So removing this doesn't have
a behavior difference, is less code, and it makes EmitGCCInlineAsmStr()
and EmitMSInlineAsmStr() more similar, to prepare for merging them later.

(Why not _add_ the branch to EmitMSInlineAsmStr() instead? Because that
always works with X86AsmPrinter I think, and
X86AsmPrinter::PrintAsmMemoryOperand() very decisively rejects the 'l'
modifier, so it's hard to motivate adding that branch.)

*: The one exception was AVRAsmPrinter, which had an llvm_unreachable instead
of returning true. So this commit changes that, so that the AVR target keeps
emitting an error instead of crashing when passing a mem operand with a :l
modifier to it. All the other targets already don't crash on this.

Differential Revision: https://reviews.llvm.org/D114216




More information about the All-commits mailing list