[all-commits] [llvm/llvm-project] 04a675: [MC] Simplify MCBinaryExpr/MCUnaryExpr printing by...

Fangrui Song via All-commits all-commits at lists.llvm.org
Sun Mar 30 22:03:35 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 04a67528d303ac4be7943b2ae57222f9c9fd509a
      https://github.com/llvm/llvm-project/commit/04a67528d303ac4be7943b2ae57222f9c9fd509a
  Author: Fangrui Song <i at maskray.me>
  Date:   2025-03-30 (Sun, 30 Mar 2025)

  Changed paths:
    M llvm/include/llvm/MC/MCExpr.h
    M llvm/lib/MC/MCExpr.cpp
    M llvm/test/CodeGen/AMDGPU/agpr-register-count.ll
    M llvm/test/CodeGen/AMDGPU/call-alias-register-usage-agpr.ll
    M llvm/test/CodeGen/AMDGPU/call-alias-register-usage1.ll
    M llvm/test/CodeGen/AMDGPU/call-alias-register-usage2.ll
    M llvm/test/CodeGen/AMDGPU/call-alias-register-usage3.ll
    M llvm/test/CodeGen/AMDGPU/function-resource-usage.ll
    M llvm/test/CodeGen/AMDGPU/mcexpr-knownbits-assign-crash-gh-issue-110930.ll
    M llvm/test/CodeGen/AMDGPU/multi-call-resource-usage-mcexpr.ll
    M llvm/test/CodeGen/AMDGPU/recursion.ll
    M llvm/test/CodeGen/AMDGPU/recursive-resource-usage-mcexpr.ll
    M llvm/test/CodeGen/AMDGPU/resource-optimization-remarks.ll
    M llvm/test/CodeGen/AMDGPU/unnamed-function-resource-info.ll
    M llvm/test/CodeGen/ARM/GlobalISel/arm-isel-globals-pic.ll
    M llvm/test/CodeGen/ARM/GlobalISel/thumb-isel-globals-pic.ll
    M llvm/test/CodeGen/ARM/elf-preemption.ll
    M llvm/test/CodeGen/ARM/globals.ll
    M llvm/test/CodeGen/ARM/litpool-licm.ll
    M llvm/test/CodeGen/ARM/load-global.ll
    M llvm/test/CodeGen/ARM/load-global2.ll
    M llvm/test/CodeGen/ARM/plt-relative-reloc.ll
    M llvm/test/CodeGen/ARM/stack-guard-elf.ll
    M llvm/test/CodeGen/ARM/stack-guard-rwpi.ll
    M llvm/test/CodeGen/PowerPC/aix-small-local-dynamic-tls-largeaccess.ll
    M llvm/test/CodeGen/PowerPC/aix-small-local-exec-tls-largeaccess.ll
    M llvm/test/CodeGen/PowerPC/aix-small-local-exec-tls-largeaccess2.ll
    M llvm/test/CodeGen/PowerPC/aix-small-tls-globalvarattr-funcattr.ll
    M llvm/test/CodeGen/PowerPC/aix-small-tls-globalvarattr-targetattr.ll
    M llvm/test/CodeGen/RISCV/dso_local_equivalent.ll
    M llvm/test/CodeGen/RISCV/plt-relative-reloc.ll
    M llvm/test/CodeGen/Thumb2/tpsoft.ll
    M llvm/test/CodeGen/X86/abi-isel.ll
    M llvm/test/CodeGen/X86/atomic-minmax-i6432.ll
    M llvm/test/CodeGen/X86/callbr-asm-instr-scheduling.ll
    M llvm/test/CodeGen/X86/inline-asm-i-constraint-i1.ll
    M llvm/test/CodeGen/X86/relptr-rodata.ll
    M llvm/test/CodeGen/X86/wineh-coreclr.ll
    M llvm/test/CodeGen/X86/x86-64-plt-relative-reloc.ll
    M llvm/test/CodeGen/X86/x86-plt-relative-reloc.ll
    M llvm/test/MC/AArch64/elf-reloc-ptrauth.s
    M llvm/test/MC/AMDGPU/expressions.s
    M llvm/test/MC/AMDGPU/hsa-sym-exprs-gfx10.s
    M llvm/test/MC/AMDGPU/hsa-sym-exprs-gfx11.s
    M llvm/test/MC/AMDGPU/hsa-sym-exprs-gfx12.s
    M llvm/test/MC/AMDGPU/hsa-sym-exprs-gfx7.s
    M llvm/test/MC/AMDGPU/hsa-sym-exprs-gfx8.s
    M llvm/test/MC/AMDGPU/hsa-sym-exprs-gfx90a.s
    M llvm/test/MC/AMDGPU/mcexpr_amd.s
    M llvm/test/MC/ARM/basic-arm-instructions.s
    M llvm/test/MC/ARM/elf-movt.s
    M llvm/test/MC/ARM/macho-word-reloc-thumb.s
    M llvm/test/MC/AVR/inst-brbc.s
    M llvm/test/MC/AVR/inst-brbs.s
    M llvm/test/MC/AVR/inst-brcc.s
    M llvm/test/MC/AVR/inst-brcs.s
    M llvm/test/MC/AVR/inst-breq.s
    M llvm/test/MC/AVR/inst-brge.s
    M llvm/test/MC/AVR/inst-brhc.s
    M llvm/test/MC/AVR/inst-brhs.s
    M llvm/test/MC/AVR/inst-brid.s
    M llvm/test/MC/AVR/inst-brie.s
    M llvm/test/MC/AVR/inst-brlo.s
    M llvm/test/MC/AVR/inst-brlt.s
    M llvm/test/MC/AVR/inst-brmi.s
    M llvm/test/MC/AVR/inst-brne.s
    M llvm/test/MC/AVR/inst-brpl.s
    M llvm/test/MC/AVR/inst-brsh.s
    M llvm/test/MC/AVR/inst-brtc.s
    M llvm/test/MC/AVR/inst-brts.s
    M llvm/test/MC/AVR/inst-brvc.s
    M llvm/test/MC/AVR/inst-brvs.s
    M llvm/test/MC/AVR/inst-rcall.s
    M llvm/test/MC/AVR/inst-rjmp.s
    M llvm/test/MC/AsmParser/directive_fill.s
    M llvm/test/MC/AsmParser/expr_symbol_modifiers.s
    M llvm/test/MC/COFF/cross-section-relative.ll
    M llvm/test/MC/ELF/reloc-directive.s
    M llvm/test/MC/Lanai/memory.s
    M llvm/test/MC/MachO/AArch64/cstexpr-gotpcrel.ll
    M llvm/test/MC/Mips/expr1.s
    M llvm/test/MC/Mips/memory-offsets.s
    M llvm/test/MC/PowerPC/ppc32-tls.s
    M llvm/test/MC/RISCV/rvi-pseudos.s
    M llvm/test/MC/SystemZ/insn-good-z196.s
    M llvm/test/MC/SystemZ/insn-good-zEC12.s
    M llvm/test/MC/SystemZ/insn-good.s
    M llvm/test/tools/llvm-objdump/MachO/ARM/symbolized-disassembly.test
    M llvm/test/tools/llvm-objdump/MachO/ARM/symbolized-subtractor.test

  Log Message:
  -----------
  [MC] Simplify MCBinaryExpr/MCUnaryExpr printing by reducing parentheses (#133674)

The existing pretty printer generates excessive parentheses for
MCBinaryExpr expressions. This update removes unnecessary parentheses
of MCBinaryExpr with +/- operators and MCUnaryExpr.
Since relocatable expressions only use + and -, this change improves
readability in most cases.

Examples:

- (SymA - SymB) + C now prints as SymA - SymB + C.
  This updates the output of -fexperimental-relative-c++-abi-vtables for
  AArch64 and x86 to `.long _ZN1B3fooEv at PLT-_ZTV1B-8`
- expr + (MCTargetExpr) now prints as expr + MCTargetExpr, with this
  change primarily affecting AMDGPUMCExpr.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list