[PATCH] Fix PR84427, PRE ANTIC iteration (again)

Richard Biener rguenther@suse.de
Fri Mar 2 17:47:00 GMT 2018


On March 2, 2018 6:11:40 PM GMT+01:00, Jeff Law <law@redhat.com> wrote:
>On 03/01/2018 06:57 AM, Richard Biener wrote:
>> 
>> This fixes another testcase that shows that our ANTIC iteration can
>> fail to converge.  The fix continues what we did with previous fixes,
>> avoid spuriously removing stuff from the expression side of the sets.
>> This time going full-in and allowing multiple expressions for the
>> same value in the sets.  I've added verification that the value-sets
>> never grow during iteration which barfed on some of the related
>> existing testcases and thus helped finishing this and fixing all
>> places where we end up somewhat randomly choosing one or another
>> expression to drop.
>> 
>> I've verified with a GIMPLE testcase that if at insertion time
>> we have multiple partially redundant expressions for the same value
>> we insert/hoist it only once.  So the only "bad" effect of the
>> patch is that the expression part of the ANTIC sets grows -- by
>> not throwing away random stuff we might also arrive at larger
>> (value) solutions for ANTIC which means we may catch previously
>> missed optimizations (or pessimizations as you know PRE...).
>> 
>> I'm not entirely happy with the timing but I'm quite confident in
>> the approach also (again) having heavily discussed this with Micha.
>> 
>> Re-boostrap and regtest running on x86_64-unknown-linux-gnu.
>> 
>> I managed to go into a different solution at the beginning asking
>> for that pred/phiblock->edge cleanup and decided to leave that in...
>> 
>> The new verification is guarded with flag_checking so if it would
>> trigger but wouldn't result in not converging a release build
>> should be not affected.
>> 
>> Richard.
>> 
>> 2018-01-03  Richard Biener  <rguenther@suse.de>
>> 
>> 	PR tree-optimization/84427
>> 	* tree-ssa-pre.c (bitmap_remove_expr_from_set): Remove.
>> 	(bitmap_set_subtract_values): Rewrite to handle multiple
>> 	exprs per value.
>> 	(clean): Likewise.
>> 	(prune_clobbered_mems): Likewise.
>> 	(phi_translate): Take edge instead of pred/phiblock.
>> 	(phi_translate_1): Likewise.
>> 	(phi_translate_set): Likewise.  Insert all translated
>> 	exprs for a value into the set, keeping possibly multiple
>> 	expressions per value.
>> 	(compute_antic_aux): Adjust for phi_translate changes.
>> 	When intersecting union the expressions and prune those
>> 	not in the final value set, keeping possibly multiple
>> 	expressions per value.  Do not use value-insertion
>> 	for unioning ANTIC_OUT U EXP_GEN - TMP_GEN but merge
>> 	all expressions.  Add verification that the value-sets
>> 	only shrink during iteration.
>> 	(compute_partial_antic_aux): Adjust for the phi_translate changes.
>> 	(do_pre_regular_insertion): Likewise.
>> 	(do_pre_partial_partial_insertion): Likewise.
>> 
>> 	* gcc.dg/torture/pr84427.c: New testcase.
>It looks like Zdenek has already filed a report against this change.
>I'll wait for resolution on that before reducing the various linux
>kernel build failures.

Can you attach the i686 one to the PR? the two existing ones are different causes already... 

Richard. 

>jeff



More information about the Gcc-patches mailing list