[llvm] [StackProtector] Introduce stack-protect-refinement pass to remove unnecessary protections. (PR #150390)

via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 18 07:01:34 PST 2025


Mermen wrote:

> A high level concern I have here is that StackSafetyAnalysis is based on SCEV, which can reason based on undefined behavior. However, my understanding is that stack protectors are also supposed to be emitted in the presence of UB (in a way, that's the whole point).

Thanks for the feedback! Hm, good point. I wonder whether I could implement some kind of "SafeSCEV" via additional flag to enable\disable assumptions that rely on UB? Such could be used in StackSafetyAnalysis.

@eugenis @vitalybuka FYI 

> All the SCEV results are only valid under the assumption of no UB, so using them for a mechanism that exists specifically to operate in the presence of UB is problematic.

Then I suggest to close this MR until we find reliable solution.

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


More information about the llvm-commits mailing list