On 7/8/2026 2:19 AM, Andrew Pinski wrote:
Since match and simplify can add unused statements to the sequence
in some cases, we should remove them before call phiopt_early_allow.
This is needed for 2 future patches. One is to allowing of comparisons,
optionally with a cast and optional with a negative expression.
The other is about supporting a way to handling
cond_removal_in_builtin_zero_pattern in match and also adding a new match
pattern to fix PR 126035 (ctz split back into one).

Bootstrapped and tested on x86_64-linux-gnu.

gcc/ChangeLog:

        * tree-ssa-phiopt.cc (remove_unused_stmts): New function.
        (gimple_simplify_phiopt): Call remove_unused_stmts before
        phiopt_early_allow.
I'm torn.  Not particularly happy with what appears to be a mini DCE pass on the sequence.  Presumably the motivation is to clean things up in a way that makes phiopt_early_allow more likely to return true by removing statements that are going to be zapped by DCE later and thus shouldn't participate in phiopt_early_allow?

jeff

Reply via email to