[llvm] 0b32769 - [ARM] Apply sign-return-address attribute to outlined function

Benson Chu via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 23 08:51:30 PDT 2024


Author: Benson Chu
Date: 2024-10-23T08:50:56-07:00
New Revision: 0b327694440f64f497eca9ca7754ff0b80798a5d

URL: https://github.com/llvm/llvm-project/commit/0b327694440f64f497eca9ca7754ff0b80798a5d
DIFF: https://github.com/llvm/llvm-project/commit/0b327694440f64f497eca9ca7754ff0b80798a5d.diff

LOG: [ARM] Apply sign-return-address attribute to outlined function

This make checking for whether PAC is necessary simpler when building
the outlined frame.

Added: 
    

Modified: 
    llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp b/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
index 51a5f895f341db..49d1f02a2f6913 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,7 @@ 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


        


More information about the llvm-commits mailing list