[all-commits] [llvm/llvm-project] b54d21: [llvm][RISCV][MC] Fix arithmetic error in pseudo p...

Paul Kirth via All-commits all-commits at lists.llvm.org
Tue Jun 2 08:18:35 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b54d214b77aac2bab9b949bb4bdd3cc511fbe944
      https://github.com/llvm/llvm-project/commit/b54d214b77aac2bab9b949bb4bdd3cc511fbe944
  Author: Paul Kirth <paulkirth at google.com>
  Date:   2026-06-02 (Tue, 02 Jun 2026)

  Changed paths:
    M llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
    M llvm/test/MC/RISCV/rvi-pseudos.s

  Log Message:
  -----------
  [llvm][RISCV][MC] Fix arithmetic error in pseudo parsing (#200217)

When arithmetic was used in RISCV pseudo instructions, like lla, the
custom parsing breaks the associativity of the operators by parsing the
entire remainder of an expression. This would lead to scenarios where we
would parse `top - 0x100 -0x10` as `top - (0x100 -0x10)` and yield the
wrong offset (`0xF0`(wrong) vs. `0x110`(correct)).

Instead, don't advance the parser and just examine the token to
determine if it's an identifier and if we should handle this case or
bail out. In cases we do handle, just use `parseExpression()`, which
will handle this correctly.



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