[gcc r16-5428] dce: Use FOR_EACH_IMM_USE_FAST instead of FOR_EACH_IMM_USE_STMT in simple_dce_from_worklist

Andrew Pinski pinskia@gcc.gnu.org
Wed Nov 19 17:14:25 GMT 2025


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

commit r16-5428-gc8eb7d8dbb9ff4eb13f476b16f8f58103cace64e
Author: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
Date:   Thu Nov 13 17:27:06 2025 -0800

    dce: Use FOR_EACH_IMM_USE_FAST instead of FOR_EACH_IMM_USE_STMT in simple_dce_from_worklist
    
    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.
    
    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 <andrew.pinski@oss.qualcomm.com>

Diff:
---
 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 53bbd7584fd8..317a0d6179b3 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;


More information about the Gcc-cvs mailing list