]> git.ipfire.org Git - thirdparty/gcc.git/commit
Introduce fold_before_rtl_expansion_p [PR122142]
authorAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Fri, 3 Oct 2025 16:54:45 +0000 (09:54 -0700)
committerAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Mon, 6 Oct 2025 05:49:04 +0000 (22:49 -0700)
commita7d8eca7244028990725ba01dd8a4ec6ebdac689
tree6e446048dc35e919fa3c6ccadb23be375f3ffa75
parent7762d809bf4ea08a7c74bd8b96ffb26e7fb923fd
Introduce fold_before_rtl_expansion_p [PR122142]

As requested in https://inbox.sourceware.org/gcc-patches/CAFiYyc1jzZSZNhTas-DdMBFOzH1p96oGN=OVj6fyjt8HzDUyCA@mail.gmail.com/T/#u.
This introduces fold_before_rtl_expansion_p to replace
`(cfun->curr_properties & PROP_last_full_fold) != 0`.
I am not a fan of include tree-pass.h in gimple-fold.h but that was the
only way to reduce the number of changes.

Bootrapped and tested on x86_64-linux-gnu.

PR tree-optimization/122142
gcc/ChangeLog:

* generic-match-head.cc: Include gimple-iterator.h
and gimple-fold.h.
* gimple-fold.cc (gimple_fold_builtin_constant_p): Use
fold_before_rtl_expansion_p.
(gimple_fold_builtin_assume_aligned): Likewise.
(gimple_fold_builtin_stdarg): Likewise.
(gimple_fold_call): Likewise.
* gimple-fold.h: Include "tree-pass.h".
(fold_before_rtl_expansion_p): New function.
* match.pd: Use fold_before_rtl_expansion_p
instead of `cfun->curr_properties & PROP_last_full_fold`.
* tree-ssa-forwprop.cc (simplify_builtin_memcmp): Likewise.
(optimize_stack_restore): Likewise.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
gcc/generic-match-head.cc
gcc/gimple-fold.cc
gcc/gimple-fold.h
gcc/match.pd
gcc/tree-ssa-forwprop.cc