This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix PR57993 (ICE in slsr)

On 07/27/2013 06:51 PM, Bill Schmidt wrote:
PR57993 reports a scenario where a conditional candidate is incorrectly
replaced when its putative "hidden basis" (the basis hidden by one or
more PHI nodes) does not dominate all of the PHI nodes on which the
candidate depends.

This indicates that the hidden basis was incorrectly identified as a
useful basis for the candidate.  There are two ways we can fix this.
One would be to add more complexity to the code that determines the
hidden basis.  Currently that code does not recursively follow the PHI
definitions backwards to ensure that the basis dominates all the PHIs.
Adding code to do this would ensure we didn't identify an incorrect
basis in the first place, but would duplicate quite a bit of existing
logic in the later analysis phase, and increase compile time.

What I've done here is to instead delay detection of the problem until
the analysis phase.  If we detect that we chose an invalid basis, we
assign an "infinite" cost to the replacement so that we won't pursue it

This requires that we know which basic block contains the basis
statement.  The basis statement may have itself been replaced by another
statement earlier, so we need to keep the candidate table up to date
with respect to such replacements.

Bootstrapped and tested on powerpc64-linux-gnu with no new regressions.
Ok for trunk?



2013-07-27  Bill Schmidt  <>

	* gimple-ssa-strength-reduction.c (replace_mult_candidate): Record
	replaced statement in the candidate table.
	(phi_add_costs): Return infinite cost when the hidden basis does
	not dominate all phis on which the candidate is dependent.
	(replace_one_candidate): Record replaced statement in the
	candidate table.


2013-07-27  Bill Schmidt  <>

	* gcc.dg/torture/pr57993.c: New test.
Looks good.  Please install!


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]