On Wed, Nov 19, 2025 at 1:53 AM Andrew Pinski
<[email protected]> wrote:
>
> When I wrote this code I forgot about FOR_EACH_IMM_USE_FAST. Since this code 
> does not change
> any of the uses inside of the loop using FOR_EACH_IMM_USE_FAST will be 
> slightly faster.
>
> Bootstrapped and tested on x86_64-linux-gnu.

OK.

> gcc/ChangeLog:
>
>         * tree-ssa-dce.cc (simple_dce_from_worklist): Use 
> FOR_EACH_IMM_USE_FAST instead of
>         FOR_EACH_IMM_USE_STMT.
>
> Signed-off-by: Andrew Pinski <[email protected]>
> ---
>  gcc/tree-ssa-dce.cc | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/gcc/tree-ssa-dce.cc b/gcc/tree-ssa-dce.cc
> index 53bbd7584fd..317a0d6179b 100644
> --- a/gcc/tree-ssa-dce.cc
> +++ b/gcc/tree-ssa-dce.cc
> @@ -2378,12 +2378,13 @@ simple_dce_from_worklist (bitmap worklist, bitmap 
> need_eh_cleanup)
>           if (gimple_code (def_stmt) != GIMPLE_PHI)
>             continue;
>
> -         gimple *use_stmt;
>           imm_use_iterator use_iter;
> +         use_operand_p use_p;
>           bool canremove = true;
>
> -         FOR_EACH_IMM_USE_STMT (use_stmt, use_iter, def)
> +         FOR_EACH_IMM_USE_FAST (use_p, use_iter, def)
>             {
> +             gimple *use_stmt = USE_STMT (use_p);
>               /* Ignore debug statements. */
>               if (is_gimple_debug (use_stmt))
>                 continue;
> --
> 2.43.0
>

Reply via email to