[PATCH] D116213: [ARM] fix bug causing shrinkwrapping not always being off using PAC
Ties Stuij via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 7 07:57:47 PST 2022
stuij updated this revision to Diff 398149.
stuij added a comment.
Yea, good point. I amended the patch.
I don't think we should worry about a pass spilling the LR and we don't do that anywhere else in the code. Practically shrinkwrapping is adjacent to the prolog/epilog inserter where we make the decision to insert PACs.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D116213/new/
https://reviews.llvm.org/D116213
Files:
llvm/lib/Target/ARM/ARMFrameLowering.cpp
llvm/test/CodeGen/Thumb2/pacbti-m-outliner-3.ll
Index: llvm/test/CodeGen/Thumb2/pacbti-m-outliner-3.ll
===================================================================
--- llvm/test/CodeGen/Thumb2/pacbti-m-outliner-3.ll
+++ llvm/test/CodeGen/Thumb2/pacbti-m-outliner-3.ll
@@ -48,7 +48,6 @@
}
; CHECK-LABEL: f:
-; CHECK: bmi .LBB
; ...
; CHECK: pac r12, lr, sp
; CHECK-NEXT: .save {r4, r5, r6, lr}
@@ -66,14 +65,13 @@
; CHECK-NEXT: sub sp, #4
; CHECK-NEXT: .cfi_def_cfa_offset 24
; ...
+; CHECK: bl OUTLINED_FUNCTION_0
+; ...
; CHECK: add sp, #4
; CHECK-NEXT: ldr r12, [sp], #4
; CHECK-NEXT: pop.w {r4, r5, r6, lr}
; CHECK-NEXT: aut r12, lr, sp
; CHECK-NEXT: bx lr
-; ...
-; CHECK: .LBB
-; CHECK: bx lr
define hidden i32 @g(i32 %a, i32 %b, i32 %c, i32 %d) local_unnamed_addr #0 {
@@ -97,8 +95,6 @@
ret i32 %retval.0
}
; CHECK-LABEL: g:
-; CHECK: bmi .LBB
-; ...
; CHECK: pac r12, lr, sp
; CHECK-NEXT: .save {r4, r5, r6, lr}
; CHECK-NEXT: push {r4, r5, r6, lr}
@@ -115,14 +111,13 @@
; CHECK-NEXT: sub sp, #4
; CHECK-NEXT: .cfi_def_cfa_offset 24
; ...
+; CHECK: bl OUTLINED_FUNCTION_0
+; ...
; CHECK: add sp, #4
; CHECK-NEXT: ldr r12, [sp], #4
; CHECK-NEXT: pop.w {r4, r5, r6, lr}
; CHECK-NEXT: aut r12, lr, sp
; CHECK-NEXT: bx lr
-; ...
-; CHECK: .LBB
-; CHECK: bx lr
; CHECK-LABEL: OUTLINED_FUNCTION_0:
; CHECK: pac r12, lr, sp
Index: llvm/lib/Target/ARM/ARMFrameLowering.cpp
===================================================================
--- llvm/lib/Target/ARM/ARMFrameLowering.cpp
+++ llvm/lib/Target/ARM/ARMFrameLowering.cpp
@@ -1811,8 +1811,7 @@
// We are disabling shrinkwrapping for now when PAC is enabled, as
// shrinkwrapping can cause clobbering of r12 when the PAC code is
// generated. A follow-up patch will fix this in a more performant manner.
- if (MF.getInfo<ARMFunctionInfo>()->shouldSignReturnAddress(
- false /*SpillsLR */))
+ if (MF.getInfo<ARMFunctionInfo>()->shouldSignReturnAddress())
return false;
return true;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116213.398149.patch
Type: text/x-patch
Size: 2118 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220107/695f58e5/attachment.bin>
More information about the llvm-commits
mailing list