[all-commits] [llvm/llvm-project] 81a845: [Mips] Fix $gp was restored when used as global re...

yingopq via All-commits all-commits at lists.llvm.org
Fri Jul 31 03:03:11 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 81a8451de62458a29dd5cef6d0c52d0a6271ca30
      https://github.com/llvm/llvm-project/commit/81a8451de62458a29dd5cef6d0c52d0a6271ca30
  Author: yingopq <115543042+yingopq at users.noreply.github.com>
  Date:   2026-07-31 (Fri, 31 Jul 2026)

  Changed paths:
    M llvm/lib/Target/Mips/MipsCallingConv.td
    M llvm/lib/Target/Mips/MipsRegisterInfo.cpp
    A llvm/test/CodeGen/Mips/write_register_gp.ll

  Log Message:
  -----------
  [Mips] Fix $gp was restored when used as global register variable (#201778)

The function `eliminateDeadMI` would check `if (MRI.isReserved(Reg))`,
now we only set GP to reserved when `!Subtarget.isABICalls()`. So
`eliminateDeadMI` delete the `move $gp, $4`. And we would restore $gp
after instr selection through `$gp_64 = LD $sp_64, 8`.

Check the module metadata `llvm.named.register.$28` to detect if $28 is
used as global register. Then append new conditon when set $gp to
reserverd status and return CalleeSavedRegs without $gp.

Fix #176546.



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