[llvm] [ARM] Apply sign-return-address attribute to outlined function (PR #107877)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 9 08:22:06 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-arm
Author: Benson Chu (pestctrl)
<details>
<summary>Changes</summary>
This make checking for whether PAC is necessary simpler when building the outlined frame.
---
Full diff: https://github.com/llvm/llvm-project/pull/107877.diff
1 Files Affected:
- (modified) llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp (+5-4)
``````````diff
diff --git a/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp b/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
index 0921e364498186..bad963fa8bb5ff 100644
--- a/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
+++ b/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
@@ -6207,6 +6207,9 @@ void ARMBaseInstrInfo::mergeOutliningCandidateAttributes(
if (CFn.hasFnAttribute("branch-target-enforcement"))
F.addFnAttr(CFn.getFnAttribute("branch-target-enforcement"));
+ if (CFn.hasFnAttribute("sign-return-address"))
+ F.addFnAttr(CFn.getFnAttribute("sign-return-address"));
+
ARMGenInstrInfo::mergeOutliningCandidateAttributes(F, Candidates);
}
@@ -6623,10 +6626,8 @@ void ARMBaseInstrInfo::buildOutlinedFrame(
MBB.addLiveIn(ARM::LR);
// Insert a save before the outlined region
- bool Auth = OF.Candidates.front()
- .getMF()
- ->getInfo<ARMFunctionInfo>()
- ->shouldSignReturnAddress(true);
+ bool Auth = MF.getInfo<ARMFunctionInfo>()
+ ->shouldSignReturnAddress(true);
saveLROnStack(MBB, It, true, Auth);
// Fix up the instructions in the range, since we're going to modify the
``````````
</details>
https://github.com/llvm/llvm-project/pull/107877
More information about the llvm-commits
mailing list