[llvm] [CFI][stackprobe] Shrink wrapper select safe prologue insertion block when inline stack probing is enabled (PR #81676)

via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 14 14:16:45 PST 2024


================
@@ -957,6 +957,15 @@ bool ShrinkWrap::runOnMachineFunction(MachineFunction &MF) {
   if (!ArePointsInteresting())
     return Changed;
 
+  const TargetLowering *TLI = MF.getSubtarget().getTargetLowering();
----------------
yozhu wrote:

In `performShrinkWrapping` we need to calculate `StackAddressUsed` for each block, regardless of whether the test `TLI->isStackProbeInstrDefinedFlagRegLiveIn()` returns true or false, so it seems that we have to iterate through instructions.

The current approach - in which the test is placed after all the analysis has been done - is relatively simple and safe - we don't have to worry about missing this test in some code paths in `performShrinkWrapping` or `postShrinkWrapping`.

https://github.com/llvm/llvm-project/pull/81676


More information about the llvm-commits mailing list