[all-commits] [llvm/llvm-project] 51eee2: [Mips] Fix clang crashes when assembling invalid M...

yingopq via All-commits all-commits at lists.llvm.org
Fri Oct 10 01:40:44 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 51eee2010d3184f21502d12d69c0234549ee3fb4
      https://github.com/llvm/llvm-project/commit/51eee2010d3184f21502d12d69c0234549ee3fb4
  Author: yingopq <115543042+yingopq at users.noreply.github.com>
  Date:   2025-10-10 (Fri, 10 Oct 2025)

  Changed paths:
    M llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
    M llvm/lib/Target/Mips/MipsInstrInfo.td
    M llvm/test/MC/Mips/branch-pseudos-bad.s

  Log Message:
  -----------
  [Mips] Fix clang crashes when assembling invalid MIPS beql instructions with --arch=mips (#156413)

>From clang version 4, mips append new instruction BeqImm and
BEQLImm, the second operand format of instruction is imm64:$imm.

1.When Mips process `beql $t0, ($t0), 1`, it think the second operand
was an imm, so match success. Then mips backend process expandBranchImm,
check the second operand `$t0` was not imm, reported asserts.
We can strengthen the second operand matching restrictions.

2.Similarly, when Mips process `beql $t0, (1), 1`, it think the second
was an imm. so match success. Then mips backend process expandBranchImm,
check the third operand `1` was not expression, reported asserts. Permit
the third operand of `beql`  to be imm.

Fixes #151453.



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