]> git.ipfire.org Git - thirdparty/gcc.git/commit
dce: Remove __builtin_stack_save during dce [PR122037]
authorAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Tue, 14 Oct 2025 16:13:51 +0000 (09:13 -0700)
committerAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Wed, 15 Oct 2025 15:51:01 +0000 (08:51 -0700)
commit94ce59ad335ac372afb4521e880add4cf8fc0607
tree091e0f83eecedc348336e66b77a730b546247be8
parent651bf5126da12488f9af0e42bd9924f1058a7d43
dce: Remove __builtin_stack_save during dce [PR122037]

__builtin_stack_save can be removed when the lhs becomes unused
as it is just recording the current StackPointer into another register.

Bootstrapped and tested on x86_64-linux-gnu.

PR tree-optimization/122037

gcc/ChangeLog:

* tree-ssa-dce.cc (eliminate_unnecessary_stmts): Remove
__builtin_stack_save when the lhs is unused.

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/vla-1.c: New test.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
gcc/testsuite/gcc.dg/tree-ssa/vla-1.c [new file with mode: 0644]
gcc/tree-ssa-dce.cc