This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Remove dead call to gimple_bb in slsr_process_phi
- From: Bill Schmidt <wschmidt at linux dot vnet dot ibm dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: richard dot guenther at gmail dot com
- Date: Mon, 25 Jul 2016 14:51:40 -0500
- Subject: [PATCH] Remove dead call to gimple_bb in slsr_process_phi
- Authentication-results: sourceware.org; auth=none
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 <wschmidt@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)