[llvm] SystemZ: Remove override of insertSSPDeclarations (PR #163708)
Ulrich Weigand via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 17 09:12:49 PDT 2025
uweigand wrote:
> > This doesn't look correct to me. Linux on SystemZ uses the `LegacyDefaultSystemLibrary` settings, which do provide the SYSTEM_CHECK_GUARD, and I verified that after removing the override, the behavior is no longer a no-op.
>
> Since no tests change with this, there is a problem. Can you add the missing test coverage @uweigand?
Well, there is a (somewhat minimalistic) test in `test/CodeGen/SystemZ/stack-guard.ll`. This does not show any difference in generated assembler output based on whether or not that declaration is visible - should it?
You can see differences in verbose dumps, e.g. current mainline:
```
$r1l = EAR $a0, implicit-def $r1d
$r1d = SLLG $r1d, $noreg, 32
$r1l = EAR $a1
renamable $r1d = LG $r1d, 40, $noreg
CG killed renamable $r1d, $r15d, 1184, $noreg, implicit-def $cc :: (volatile load (s64) from %stack.0.StackGuardSlot)
```
vs. with your patch:
```
$r1l = EAR $a0, implicit-def $r1d
$r1d = SLLG $r1d, $noreg, 32
$r1l = EAR $a1
renamable $r1d = LG $r1d, 40, $noreg :: (dereferenceable invariant load (s64) from @__stack_chk_guard)
CG killed renamable $r1d, $r15d, 1184, $noreg, implicit-def $cc :: (volatile load (s64) from %stack.0.StackGuardSlot)
```
Not sure if there is any more complex code sequence where that could result in observable assembler differences. Either way, it looks to me like current mainline (without the declaration) is more correct as we do not actually use any global variable `__stack_chk_guard` but rather a TLS slot (the EAR/SLLG/EAR sequence retrieves the address of the TLS area).
https://github.com/llvm/llvm-project/pull/163708
More information about the llvm-commits
mailing list