On 6/19/2021 3:49 PM, apinski--- via Gcc-patches wrote:
From: Andrew Pinski <apin...@marvell.com>

To improve phiopt and be able to remove abs_replacement, this ports
most of "A CMP 0 ? A : -A" from fold_cond_expr_with_comparison to
match.pd.  There is a few extra changes that are needed to remove
the "A CMP 0 ? A : -A" part from fold_cond_expr_with_comparison:
    * Need to handle (A - B) case
    * Need to handle UN* comparisons.

I will handle those in a different patch.

Note phi-opt-15.c test needed to be updated as we get ABSU now
instead of not getting ABS.  When ABSU was added phiopt was not
updated even to use ABSU instead of not creating ABS.

OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

gcc/ChangeLog:

        * match.pd (A CMP 0 ? A : -A): New patterns.
        * tree-ssa-phiopt.c (abs_replacement): Delete function.
        (tree_ssa_phiopt_worker): Don't call abs_replacement.
        Update comment about abs_replacement.

gcc/testsuite/ChangeLog:

        * gcc.dg/tree-ssa/phi-opt-15.c: Update test to expect
        ABSU and still not expect ABS_EXPR.

+(for cnd (cond vec_cond)
+ /* A == 0? A : -A    same as -A */
                       ^^
Missing whitespace.  This occurs in the comment each pattern.

OK with the nits fixed.

jeff

Reply via email to