]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
prop: Remove may_propagate_copy_into_asm [PR122182]
authorAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Mon, 13 Oct 2025 21:04:31 +0000 (14:04 -0700)
committerAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Tue, 14 Oct 2025 06:46:00 +0000 (23:46 -0700)
may_propagate_copy_into_asm has been returning true always since r0-118216-g01c59d23df7eef.
Many places that checks may_propagate_copy don't check
may_propagate_copy_into_asm for asm_expr. may_propagate_copy_into_stmt
does not check when you would have expected it to. So let's remove may_propagate_copy_into_asm
and remove the checks from substitute_and_fold_engine and dom.

Bootstrapped and tested on x86_64-linux-gnu.

PR tree-optimization/122182
gcc/ChangeLog:

* tree-ssa-dom.cc (cprop_operand): Don't check may_propagate_copy_into_asm.
* tree-ssa-propagate.cc (substitute_and_fold_engine::replace_uses_in): Don't
check may_propagate_copy_into_asm.
(may_propagate_copy_into_asm): Remove.
* tree-ssa-propagate.h (may_propagate_copy_into_asm): Remove.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
gcc/tree-ssa-dom.cc
gcc/tree-ssa-propagate.cc
gcc/tree-ssa-propagate.h

index b1ac35e12fd97b52e1720be7af7083b248461c76..087d8424ae9f526f2f9bcb75495a7fbfe5d1ddcf 100644 (file)
@@ -2040,11 +2040,6 @@ cprop_operand (gimple *stmt, use_operand_p op_p, range_query *query)
 
   if (val && val != op)
     {
-      /* Do not replace hard register operands in asm statements.  */
-      if (gimple_code (stmt) == GIMPLE_ASM
-         && !may_propagate_copy_into_asm (op))
-       return;
-
       /* Certain operands are not allowed to be copy propagated due
         to their interaction with exception handling and some GCC
         extensions.  */
index 872f881b644cd67c01f98e0f312717684b6ad17b..f02b10ddc48faa8789c189209f24c57f5857470b 100644 (file)
@@ -578,10 +578,6 @@ substitute_and_fold_engine::replace_uses_in (gimple *stmt)
       if (val == tuse || val == NULL_TREE)
        continue;
 
-      if (gimple_code (stmt) == GIMPLE_ASM
-         && !may_propagate_copy_into_asm (tuse))
-       continue;
-
       if (!may_propagate_copy (tuse, val))
        continue;
 
@@ -1142,15 +1138,6 @@ may_propagate_copy_into_stmt (gimple *dest, tree orig)
   return true;
 }
 
-/* Similarly, but we know that we're propagating into an ASM_EXPR.  */
-
-bool
-may_propagate_copy_into_asm (tree dest ATTRIBUTE_UNUSED)
-{
-  return true;
-}
-
-
 /* Replace *OP_P with value VAL (assumed to be a constant or another SSA_NAME).
 
    Use this version when not const/copy propagating values.  For example,
index 200fc7320796f47d975ec4c035422b4e4fbf1e44..7819c0c15bcd64e99f3a7dcccaf26a6f99b91a4f 100644 (file)
@@ -67,7 +67,6 @@ extern void move_ssa_defining_stmt_for_defs (gimple *, gimple *);
 extern bool stmt_makes_single_store (gimple *);
 extern bool may_propagate_copy (tree, tree, bool = false);
 extern bool may_propagate_copy_into_stmt (gimple *, tree);
-extern bool may_propagate_copy_into_asm (tree);
 extern void propagate_value (use_operand_p, tree);
 extern void replace_exp (use_operand_p, tree);
 extern void propagate_tree_value (tree *, tree);