[llvm] [RISC-V] Use an optional offset operand instead of zero-offset InstAliases (PR #210901)

Alexander Richardson via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 1 15:37:28 PDT 2026


arichardson wrote:

> Sorry, yes, if you can add one test that shows the difference in diagnostic for a `lw`, that would be helpful :)
> 
> The change isn't trying to be NFCI, it's trying to improve the messages, so we should show that.

I tried to come up with a test that shows that this changes the behaviour. For some reason it does with the compressed loads/stores, but I was not able to come up with a test case for lw that has a difference.

At the parent commit the cases that cause invalid operand errors with compressed loads don't for normal loads/jalr:                                                                                                              
```                                                                                                                                                                                                                     
$ echo "lb a0, -2049(a1)" | llvm-mc -triple riscv32                                                                                                                                                                
  <stdin>:1:8: error: operand must be a symbol with %lo/%pcrel_lo/%tprel_lo specifier or an integer in the range [-2048, 2047]                                                                                       
```                                                                                                                                                                                       
For some reason (I wasn't able to trace it), the matches falls back to the ambiguous "invalid instruction" for the compressed pattenrs but not simm12_lo.

So unless you can think of a case that I'd suggest calling this commit a NFC simplification of the tablegen files and the follow-ups as real changes.

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


More information about the llvm-commits mailing list