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

yingopq via All-commits all-commits at lists.llvm.org
Mon Oct 13 07:19:32 PDT 2025


  Branch: refs/heads/release/21.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 13bee3a798b16fea0f81f75dfbd4d82e04df818b
      https://github.com/llvm/llvm-project/commit/13bee3a798b16fea0f81f75dfbd4d82e04df818b
  Author: yingopq <115543042+yingopq at users.noreply.github.com>
  Date:   2025-10-13 (Mon, 13 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.

(cherry picked from commit 51eee2010d3184f21502d12d69c0234549ee3fb4)



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