[llvm] [CodeGen] Use byte offsets and ptradd in ShadowStackGCLowering (PR #178436)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 8 19:58:09 PDT 2026
isuckatcs wrote:
So to summarize it. There is a behavior that is experienced with LLVM for years, which ALLOWS non-pointer alloca roots. There is the IR verifier, which explicitly ALLOWS non-pointer alloca roots.
This contradicts with 1 line in 1 of 2 documentations for `llvm.gcroot`, which states that a `null` pointer is stored in the root, which suggests non-pointer roots are NOT allowed.
**Did you ever ask the question what if the documentation is wrong?** Maybe there was a change after which they forgot to update it (to be fair, I forgot to update that part as well after my change, because I wasn't aware of its existence).
To settle this debate once and for all, however, I did some investigation and found https://github.com/llvm/llvm-project/commit/2e59f142cc64c7f91065786e0b9486ae77609aa0, where the commit message states that the goal was to
> Allow llvm.gcroot to work with non-pointer allocas.
This commit is still live today if you check the blame.
<img width="951" height="354" alt="image" src="https://github.com/user-attachments/assets/ffbfc6cb-0e61-4549-b1c8-36fefe9bcbd1" />
I think it is safe to conclude that `llvm.gcroot` can be used with non-pointer allocas since 2010. This optimization doesn't take this into consideration, which results in a regression.
As a result I think it is reasonable to revert it to unblock anyone who might experience this regression on the `main` branch.
https://github.com/llvm/llvm-project/pull/178436
More information about the llvm-commits
mailing list