https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126954

--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrea Pinski <[email protected]>:

https://gcc.gnu.org/g:ac1c1f64e11b84ba6a5e8dbef4589f8369df7d08

commit r17-3526-gac1c1f64e11b84ba6a5e8dbef4589f8369df7d08
Author: Andrea Pinski <[email protected]>
Date:   Thu Aug 20 23:37:54 2026 -0700

    match: Use match to match mult for mul_ladder_sum1 [PR126954]

    While reading match patterns I noticed that currently
    mul_ladder_sum1 does this:
    ```
        @mul_hilo1)
      (with {
        tree_code mul_hilo_code = TREE_CODE (@mul_hilo1);
        tree_code rhs_code = ERROR_MARK;
        if (mul_hilo_code == SSA_NAME)
          {
            gimple *def = SSA_NAME_DEF_STMT (@mul_hilo1);
            if (def && gimple_code (def) == GIMPLE_ASSIGN)
              rhs_code = gimple_assign_rhs_code (def);
          } }
      (if (rhs_code == MULT_EXPR))))
    ```

    Which is exactly the same thing if the match pattern did:
        (mult@mul_hilo1 @2 @3)))

    Which is easier to understand and will use the valueizier if
    there is one instead of a straight walk backwards on the ssa names.

    I also checked the generated code from genmatch to see it was similar
    in what was done manually.

    Pushed as obvious after a bootstrap/test for x86_64-linux-gnu.

            PR tree-optimization/126954

    gcc/ChangeLog:

            * match.pd (mul_ladder_sum1): Change over to match syntax
            instead of doing it manually.

    Signed-off-by: Andrea Pinski <[email protected]>

Reply via email to