https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110484

            Bug ID: 110484
           Summary: Spec2017 541 after adding the
                    '-flto-fomit-frame-pointer' optimization, after
                    optimizing the rnreg, directly replaced other
                    registers with the $r22 register, so that the value of
                    the $r22 register was destroyed without being saved.
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chenglulu at loongson dot cn
  Target Milestone: ---
            Target: loongarch64-*-linux

Spec2017 541 after adding the '-flto-fomit-frame-pointer' optimization, after
optimizing the rnreg, directly replaced other registers with the $r22 register,
so that the value of the $r22 register was destroyed without being saved.

Through debugging, it was found that when compiling the SGFTree .cpp file, the
load_from_file function generated the following template in pro_and_epilogue
optimization:
(insn 782 781 783 61 (set (mem:BLK (scratch) [0  A8])
        (unspec:BLK [
                (reg/f:DI 3 $r3)
                (reg/f:DI 22 $r22)
            ] UNSPEC_TIE)) "SGFTree.cpp":115:1 -1
     (nil))
This results in $r22 being present in the load_from_file's reg ever live list
thereafter. However, this is not desirable when the $r22 register is not used
in the function.

Reply via email to