[llvm] [LoongArch] Ensure pcaddu18i and jirl adjacency in tail calls for correct relocation (PR #113932)
WÁNG Xuěruì via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 30 21:20:49 PDT 2024
https://github.com/xen0n approved this pull request.
Just some excerpt from an unpatched LLVM compiling the `caller_call_tail` reproducer:
```llvm
; MEDIUM-LABEL: caller_call_tail:
; MEDIUM: # %bb.0: # %entry
; MEDIUM-NEXT: addi.d $sp, $sp, -16
; MEDIUM-NEXT: st.d $ra, $sp, 8 # 8-byte Folded Spill
; MEDIUM-NEXT: st.d $fp, $sp, 0 # 8-byte Folded Spill
; MEDIUM-NEXT: move $fp, $a0
; MEDIUM-NEXT: pcaddu18i $ra, %call36(callee_tail)
; MEDIUM-NEXT: jirl $ra, $ra, 0
; MEDIUM-NEXT: move $a0, $fp
; MEDIUM-NEXT: pcaddu18i $a1, %call36(callee_tail)
; MEDIUM-NEXT: ld.d $fp, $sp, 0 # 8-byte Folded Reload
; MEDIUM-NEXT: ld.d $ra, $sp, 8 # 8-byte Folded Reload
; MEDIUM-NEXT: addi.d $sp, $sp, 16
; MEDIUM-NEXT: jr $a1
```
So now we can be really confident that those failure modes would never happen again with this change. Thanks!
https://github.com/llvm/llvm-project/pull/113932
More information about the llvm-commits
mailing list