[all-commits] [llvm/llvm-project] ba019b: [SPARC] Fix SelectForceADDRrr for global addresses...

Bart Van Assche via All-commits all-commits at lists.llvm.org
Wed Sep 16 14:34:44 PDT 2026


  Branch: refs/heads/release/23.x
  Home:   https://github.com/llvm/llvm-project
  Commit: ba019b7aafce09a013cf7e9139fa0c229f09b188
      https://github.com/llvm/llvm-project/commit/ba019b7aafce09a013cf7e9139fa0c229f09b188
  Author: Bart Van Assche <bvanassche at users.noreply.github.com>
  Date:   2026-09-16 (Wed, 16 Sep 2026)

  Changed paths:
    M llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp
    M llvm/test/CodeGen/SPARC/bswap.ll

  Log Message:
  -----------
  [SPARC] Fix SelectForceADDRrr for global addresses and non-reg operands (#220013)

When lowering byte-swapped memory operations on SPARC V9, LLVM emits
ASI-tagged memory instructions (such as STHArr, STArr, LDArr, etc.) that
require register+register addressing modes matched via ForceADDRrr.

SelectForceADDRrr previously forwarded 2-operand address nodes directly
to SelectADDRrr. However, SelectADDRrr explicitly returns false when
encountering SPISD::Lo (used in %hi/%lo global address calculations) or
small constant offsets in order to allow standard ADDRri patterns to
match. Because SelectForceADDRrr returned the result of SelectADDRrr
directly instead of falling back to Base = Addr, Disp = %g0, any
endian-adjusted load or store targeting a global variable failed to
select and caused a backend compiler crash:
  "Cannot select: SPISD::STORE_LITTLE ..."

Fix SelectForceADDRrr so that if SelectADDRrr fails to match, it falls
back to evaluating the full address into a base register and using %g0
as the offset register. Also add tests for global variable byte-swapped
loads and stores.

Fixes: 1ba7c9677649 ("[SPARC] Use hardware byteswapper when we have V9
(#191720)")

Signed-off-by: Bart Van Assche <bvanassche at acm.org>
(cherry picked from commit d378144735cb1021608003ee418b54d402a5ac98)



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