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 <rguent...@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. Note most of my testers are failing with:
during GIMPLE pass: pre ../net/packet/af_packet.c: In function 'packet_setsockopt': ../net/packet/af_packet.c:3611:1: internal compiler error: in compute_antic_aux, at tree-ssa-pre.c:2148 packet_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int optlen) ^~~~~~~~~~~~~~~~~ 0xdfdb02 compute_antic_aux ../../../gcc/gcc/tree-ssa-pre.c:2148 0xdfdb02 compute_antic ../../../gcc/gcc/tree-ssa-pre.c:2364 0xdfdb02 execute ../../../gcc/gcc/tree-ssa-pre.c:4131 aarch, alpha, arm, nios, s390, riscv, mips, hppa, microblaze, i686, powerpc. On a positive note, sh seems unaffected :-) I'll try to get a testcase extracted. jeff