[PATCH] D147372: [libunwind][LoongArch] Restore $r1 before $r4 in `jumpto`

WÁNG Xuěruì via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 2 00:49:32 PDT 2023


xen0n added inline comments.


================
Comment at: libunwind/src/UnwindRegistersRestore.S:1225
   ld.d    $r1,  $a0, (8 * 32)  // load new pc into $ra
+  ld.d    $r4,  $a0, (8 * 4)   // restore $a0 last
 
----------------
Ah now I know why no one has noticed this before. Someone mixed raw register names (`$r1` `r4`) and ABI names (`$ra` `$a0`) so the flaw was not immediately noticeable otherwise.

So, in order to reduce unnecessary mental burden reading this, I'd suggest changing `$r1` and `$r4` to ABI names while at it. The code change is okay otherwise, thanks for the patch!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147372/new/

https://reviews.llvm.org/D147372



More information about the llvm-commits mailing list