[lld] [llvm] [RISCV] Teach RISCVMergeBaseOffset to merge %lo into load/store folding arithmetic (PR #185353)

via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 9 01:48:11 PDT 2026


github-actions[bot] wrote:

<!--PREMERGE ADVISOR COMMENT: Windows-->
# :window: Windows x64 Test Results

* 131947 tests passed
* 2983 tests skipped
* 3 tests failed

## Failed Tests
(click on a test name to see its output)

### LLVM
<details>
<summary>LLVM.CodeGen/RISCV/GlobalISel/add-imm.ll</summary>

```
Exit Code: 2

Command Output (stdout):
--
# RUN: at line 2
c:\_work\llvm-project\llvm-project\build\bin\llc.exe -mtriple=riscv32 -global-isel < C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\RISCV\GlobalISel\add-imm.ll  | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\RISCV\GlobalISel\add-imm.ll -check-prefix=RV32I
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llc.exe' -mtriple=riscv32 -global-isel
# .---command stderr------------
# | Assertion failed: isReg() && "This is not a register operand!", file C:\_work\llvm-project\llvm-project\llvm\include\llvm/CodeGen/MachineOperand.h, line 373
# | PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
# | Stack dump:
# | 0.	Program arguments: c:\\_work\\llvm-project\\llvm-project\\build\\bin\\llc.exe -mtriple=riscv32 -global-isel
# | 1.	Running pass 'Function Pass Manager' on module '<stdin>'.
# | 2.	Running pass 'RISC-V Merge Base Offset' on function '@add32_reject'
# | Exception Code: 0xC000001D
# |  #0 0x00007ff7f73812e6 (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0x2cf12e6)
# |  #1 0x00007ffaae97bb04 (C:\Windows\System32\ucrtbase.dll+0x7bb04)
# |  #2 0x00007ffaae97cad1 (C:\Windows\System32\ucrtbase.dll+0x7cad1)
# |  #3 0x00007ffaae97e4a1 (C:\Windows\System32\ucrtbase.dll+0x7e4a1)
# |  #4 0x00007ffaae97e6e1 (C:\Windows\System32\ucrtbase.dll+0x7e6e1)
# |  #5 0x00007ff7f602c932 (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0x199c932)
# |  #6 0x00007ff7f50d5ce3 (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0xa45ce3)
# |  #7 0x00007ff7f4b48ac9 (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0x4b8ac9)
# |  #8 0x00007ff7f4b5155d (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0x4c155d)
# |  #9 0x00007ff7f4b49748 (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0x4b9748)
# | #10 0x00007ff7f4697908 (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0x7908)
# | #11 0x00007ff7f4694b76 (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0x4b76)
# | #12 0x00007ff7f8e48b20 (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0x47b8b20)
# | #13 0x00007ffab4a94cb0 (C:\Windows\System32\KERNEL32.DLL+0x14cb0)
# | #14 0x00007ffac21bedcb (C:\Windows\SYSTEM32\ntdll.dll+0x7edcb)
# `-----------------------------
# error: command failed with exit status: 0xc000001d
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 'C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\RISCV\GlobalISel\add-imm.ll' -check-prefix=RV32I
# .---command stderr------------
# | FileCheck error: '<stdin>' is empty.
# | FileCheck command line:  c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\RISCV\GlobalISel\add-imm.ll -check-prefix=RV32I
# `-----------------------------
# error: command failed with exit status: 2

--

```
</details>
<details>
<summary>LLVM.MC/RISCV/Relocations/mc-dump.s</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 2
c:\_work\llvm-project\llvm-project\build\bin\llvm-mc.exe -filetype=obj --triple=riscv64 --mattr=+relax C:\_work\llvm-project\llvm-project\llvm\test\MC\RISCV\Relocations\mc-dump.s -debug-only=mc-dump -o /dev/null 2>&1 | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\MC\RISCV\Relocations\mc-dump.s
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llvm-mc.exe' -filetype=obj --triple=riscv64 --mattr=+relax 'C:\_work\llvm-project\llvm-project\llvm\test\MC\RISCV\Relocations\mc-dump.s' -debug-only=mc-dump -o /dev/null
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 'C:\_work\llvm-project\llvm-project\llvm\test\MC\RISCV\Relocations\mc-dump.s'
# .---command stderr------------
# | C:\_work\llvm-project\llvm-project\llvm\test\MC\RISCV\Relocations\mc-dump.s:10:15: error: CHECK-NEXT: expected string not found in input
# | # CHECK-NEXT: Fixup @0 Value:specifier(4014,ext) Kind:4023 LinkerRelaxable
# |               ^
# | <stdin>:8:56: note: scanning from here
# | 0 Data LinkerRelaxable Size:8 [97,00,00,00,e7,80,00,00]
# |                                                        ^
# | <stdin>:9:2: note: possible intended match here
# |  Fixup @0 Value:specifier(4014,ext) Kind:4027 LinkerRelaxable
# |  ^
# | 
# | Input file: <stdin>
# | Check file: C:\_work\llvm-project\llvm-project\llvm\test\MC\RISCV\Relocations\mc-dump.s
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |            1: assembler backend - final-layout 
# |            2: -- 
# |            3: Sections:[ 
# |            4: MCSection Name:.text FirstLinkerRelaxable:1 
# |            5: 0 Align Size:0+0 [] 
# |            6:  Align:4 Fill:0 FillLen:1 MaxBytesToEmit:4 Nops 
# |            7:  Symbol @0 .text 
# |            8: 0 Data LinkerRelaxable Size:8 [97,00,00,00,e7,80,00,00] 
# | next:10'0                                                            X error: no match found
# |            9:  Fixup @0 Value:specifier(4014,ext) Kind:4027 LinkerRelaxable 
# | next:10'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | next:10'1      ?                                                             possible intended match
# |           10:  Symbol @0 $x 
# | next:10'0     ~~~~~~~~~~~~~~
# |           11: 8 Align LinkerRelaxable Size:0+6 [] 
# | next:10'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           12:  Align:8 Fill:0 FillLen:1 MaxBytesToEmit:8 Nops 
# | next:10'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           13:  Fixup @0 Value:6 Kind:2043 
# | next:10'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           14: 14 Align LinkerRelaxable Size:4+6 [13,05,30,00] 
# | next:10'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            .
# |            .
# |            .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>
<details>
<summary>LLVM.MC/RISCV/Relocations/relocations.s</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
c:\_work\llvm-project\llvm-project\build\bin\llvm-mc.exe -triple riscv32 -M no-aliases C:\_work\llvm-project\llvm-project\llvm\test\MC\RISCV\Relocations\relocations.s -show-encoding      | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe -check-prefix=INSTR C:\_work\llvm-project\llvm-project\llvm\test\MC\RISCV\Relocations\relocations.s
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llvm-mc.exe' -triple riscv32 -M no-aliases 'C:\_work\llvm-project\llvm-project\llvm\test\MC\RISCV\Relocations\relocations.s' -show-encoding
# .---command stderr------------
# | C:\_work\llvm-project\llvm-project\llvm\test\MC\RISCV\Relocations\relocations.s:165:1: error: instruction requires the following: 'Zba' (Address Generation Instructions), RV64I Base Instruction Set
# | add.uw t1, t1, t2, %gprel_add(foo)
# | ^
# | C:\_work\llvm-project\llvm-project\llvm\test\MC\RISCV\Relocations\relocations.s:169:1: error: instruction requires the following: 'Zba' (Address Generation Instructions)
# | sh1add t1, t1, t2, %gprel_shxadd(foo)
# | ^
# | C:\_work\llvm-project\llvm-project\llvm\test\MC\RISCV\Relocations\relocations.s:173:1: error: instruction requires the following: 'Zba' (Address Generation Instructions), RV64I Base Instruction Set
# | sh1add.uw t1, t1, t2, %gprel_shxadd(foo)
# | ^
# | C:\_work\llvm-project\llvm-project\llvm\test\MC\RISCV\Relocations\relocations.s:177:1: error: instruction requires the following: 'Zba' (Address Generation Instructions)
# | sh2add t1, t1, t2, %gprel_shxadd(foo)
# | ^
# | C:\_work\llvm-project\llvm-project\llvm\test\MC\RISCV\Relocations\relocations.s:181:1: error: instruction requires the following: 'Zba' (Address Generation Instructions), RV64I Base Instruction Set
# | sh2add.uw t1, t1, t2, %gprel_shxadd(foo)
# | ^
# | C:\_work\llvm-project\llvm-project\llvm\test\MC\RISCV\Relocations\relocations.s:185:1: error: instruction requires the following: 'Zba' (Address Generation Instructions)
# | sh3add t1, t1, t2, %gprel_shxadd(foo)
# | ^
# | C:\_work\llvm-project\llvm-project\llvm\test\MC\RISCV\Relocations\relocations.s:189:1: error: instruction requires the following: 'Zba' (Address Generation Instructions), RV64I Base Instruction Set
# | sh3add.uw t1, t1, t2, %gprel_shxadd(foo)
# | ^
# `-----------------------------
# error: command failed with exit status: 1
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' -check-prefix=INSTR 'C:\_work\llvm-project\llvm-project\llvm\test\MC\RISCV\Relocations\relocations.s'
# .---command stderr------------
# | C:\_work\llvm-project\llvm-project\llvm\test\MC\RISCV\Relocations\relocations.s:167:10: error: INSTR: expected string not found in input
# | # INSTR: add t1, t1, t2, %gprel_add(foo)
# |          ^
# | <stdin>:111:33: note: scanning from here
# |  add t1, t1, t2, %gprel_add(foo) # encoding: [0x33,0x03,0x73,0x00]
# |                                 ^
# | <stdin>:112:16: note: possible intended match here
# |  # fixup A - offset: 0, value: %gprel_add(foo), relocation type: 68
# |                ^
# | 
# | Input file: <stdin>
# | Check file: C:\_work\llvm-project\llvm-project\llvm\test\MC\RISCV\Relocations\relocations.s
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |              .
# |              .
# |              .
# |            106:  # fixup A - offset: 0, value: %pcrel_lo(.L4), kind: fixup_riscv_pcrel_lo12_s 
# |            107:  
# |            108:  add t1, t1, tp, %tprel_add(foo) # encoding: [0x33,0x03,0x43,0x00] 
# |            109:  # fixup A - offset: 0, value: %tprel_add(foo), relocation type: 32 
# |            110:  
# |            111:  add t1, t1, t2, %gprel_add(foo) # encoding: [0x33,0x03,0x73,0x00] 
# | check:167'0                                     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
# |            112:  # fixup A - offset: 0, value: %gprel_add(foo), relocation type: 68 
# | check:167'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | check:167'1                    ?                                                     possible intended match
# |            113:  
# | check:167'0     ~
# |            114:  
# | check:167'0     ~
# |            115:  
# | check:167'0     ~
# |            116:  
# | check:167'0     ~
# |            117:  
# | check:167'0     ~
# |              .
# |              .
# |              .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label.

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


More information about the llvm-commits mailing list