[llvm] [LegalizeDAG] Use Base+Offset instead of Offset+Base for jump tables (PR #125279)

Alexander Richardson via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 31 12:07:39 PST 2025


================
@@ -89,7 +89,7 @@ define void @above_threshold(i32 signext %in, ptr %out) nounwind {
 ; RV32I-SMALL-NEXT:    slli a0, a0, 2
 ; RV32I-SMALL-NEXT:    lui a2, %hi(.LJTI1_0)
 ; RV32I-SMALL-NEXT:    addi a2, a2, %lo(.LJTI1_0)
-; RV32I-SMALL-NEXT:    add a0, a0, a2
+; RV32I-SMALL-NEXT:    add a0, a2, a0
 ; RV32I-SMALL-NEXT:    lw a0, 0(a0)
----------------
arichardson wrote:

@topperc It looks like the MIPS combine could also be useful for RISC-V (and I believe LoongArch) here? Not sure if that's something that could easily be made generic.

https://github.com/llvm/llvm-project/pull/125279


More information about the llvm-commits mailing list