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-optmization/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 <[email protected]>
---
 gcc/tree-ssa-dom.cc       |  5 -----
 gcc/tree-ssa-propagate.cc | 13 -------------
 gcc/tree-ssa-propagate.h  |  1 -
 3 files changed, 19 deletions(-)

diff --git a/gcc/tree-ssa-dom.cc b/gcc/tree-ssa-dom.cc
index b1ac35e12fd..087d8424ae9 100644
--- a/gcc/tree-ssa-dom.cc
+++ b/gcc/tree-ssa-dom.cc
@@ -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.  */
diff --git a/gcc/tree-ssa-propagate.cc b/gcc/tree-ssa-propagate.cc
index 872f881b644..f02b10ddc48 100644
--- a/gcc/tree-ssa-propagate.cc
+++ b/gcc/tree-ssa-propagate.cc
@@ -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,
diff --git a/gcc/tree-ssa-propagate.h b/gcc/tree-ssa-propagate.h
index 200fc732079..7819c0c15bc 100644
--- a/gcc/tree-ssa-propagate.h
+++ b/gcc/tree-ssa-propagate.h
@@ -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);
-- 
2.43.0

Reply via email to