Hi, 

As reported on the gcc mailing list, slsr_process_phi contains a dead call
to gimple_bb.  I looked into why this wasn't noticed before, and concluded
that we don't actually need the call.  To reach this point, the phi argument
must not correspond to a strength-reduction candidate in the table, and must
not be a function argument.  Since even simple copies and casts create entries
in the candidate table, the definition of the phi arg has a non-trivial RHS
that is not of a form useful to strength reduction, and thus there is no
reason to proceed; the phi is itself therefore not a strength reduction
candidate.

The existing logic leaves arg_bb with its initial NULL value, which correctly
terminates processing for this phi.  Thus I am just changing the logic to
make this explicit, and we don't need the call to gimple_bb at all.

Bootstrapped and tested on powerpc64le-unknown-linux-gnu with no regressions.
Is this ok for trunk?  (The error is harmless, so I see no reason for a
backport.)

Thanks!
Bill


2016-07-25  Bill Schmidt  <wschm...@linux.vnet.ibm.com>

        * gimple-ssa-strength-reduction.c (slsr_process_phi): Remove dead
        and unnecessary call to gimple_bb.


Index: gcc/gimple-ssa-strength-reduction.c
===================================================================
--- gcc/gimple-ssa-strength-reduction.c (revision 238719)
+++ gcc/gimple-ssa-strength-reduction.c (working copy)
@@ -785,14 +785,10 @@ slsr_process_phi (gphi *phi, bool speed)
                savings += stmt_cost (arg_stmt, speed);
            }
        }
-      else
+      else if (SSA_NAME_IS_DEFAULT_DEF (arg))
        {
          derived_base_name = arg;
-
-         if (SSA_NAME_IS_DEFAULT_DEF (arg))
-           arg_bb = single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun));
-         else
-           gimple_bb (SSA_NAME_DEF_STMT (arg));
+         arg_bb = single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun));
        }
 
       if (!arg_bb || arg_bb->loop_father != cand_loop)

Reply via email to