On Mon, 18 Mar 2013, Richard Biener wrote: > > This moves VRP after late DOM. This is because VRP has a hard > time dealing with non-copyproped (and not CSEd) IL and conveniently > DOM provides both. I noticed this when working on PR56273 where > we miss quite some VRP opportunities because of this. > I cannot think of a good reason to have the current order, so I am > going ahead with this after SVN is back. > > Bootstrap and regtest running on x86_64-unknown-linux-gnu. > > While I have the patch in my tree for quite a while I don't > remember testing it, so the patch may get some additional > testsuite fallout changes.
Not much - I had to adjust gcc.dg/tree-ssa/vrp47.c and c-c++-common/uninit-17.c for which I also filed a bug (reported locations are rather random, this time changing from the not-expected to another not-expected one). Will commit after new gcc.gnu.org has settled a bit. Richard. 2013-03-18 Richard Biener <rguent...@suse.de> PR tree-optimization/56273 * passes.c (init_optimization_passes): Move second VRP after DOM. * gcc.dg/tree-ssa/vrp47.c: Adjust. * c-c++-common/uninit-17.c: Likewise. Index: gcc/passes.c =================================================================== *** gcc/passes.c.orig 2013-03-18 14:27:05.000000000 +0100 --- gcc/passes.c 2013-03-18 14:33:08.745959939 +0100 *************** init_optimization_passes (void) *** 1488,1494 **** NEXT_PASS (pass_lower_vector_ssa); NEXT_PASS (pass_cse_reciprocals); NEXT_PASS (pass_reassoc); - NEXT_PASS (pass_vrp); NEXT_PASS (pass_strength_reduction); NEXT_PASS (pass_dominator); /* The only const/copy propagation opportunities left after --- 1488,1493 ---- *************** init_optimization_passes (void) *** 1497,1502 **** --- 1496,1502 ---- only examines PHIs to discover const/copy propagation opportunities. */ NEXT_PASS (pass_phi_only_cprop); + NEXT_PASS (pass_vrp); NEXT_PASS (pass_cd_dce); NEXT_PASS (pass_tracer); Index: gcc/testsuite/gcc.dg/tree-ssa/vrp47.c =================================================================== *** gcc/testsuite/gcc.dg/tree-ssa/vrp47.c.orig 2013-03-18 14:27:05.000000000 +0100 --- gcc/testsuite/gcc.dg/tree-ssa/vrp47.c 2013-03-18 14:33:08.746959950 +0100 *************** *** 4,10 **** jumps when evaluating an && condition. VRP is not able to optimize this. */ /* { dg-do compile { target { ! "mips*-*-* s390*-*-* avr-*-* mn10300-*-*" } } } */ ! /* { dg-options "-O2 -fdump-tree-vrp1 -fdump-tree-dom1 -fdump-tree-dom2" } */ /* { dg-additional-options "-march=i586" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */ /* Skip on ARM Cortex-M0, where LOGICAL_OP_NON_SHORT_CIRCUIT is set to false, leading to two conditional jumps when evaluating an && condition. VRP is --- 4,10 ---- jumps when evaluating an && condition. VRP is not able to optimize this. */ /* { dg-do compile { target { ! "mips*-*-* s390*-*-* avr-*-* mn10300-*-*" } } } */ ! /* { dg-options "-O2 -fdump-tree-vrp1 -fdump-tree-dom1 -fdump-tree-vrp2" } */ /* { dg-additional-options "-march=i586" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */ /* Skip on ARM Cortex-M0, where LOGICAL_OP_NON_SHORT_CIRCUIT is set to false, leading to two conditional jumps when evaluating an && condition. VRP is *************** int f(int x) *** 40,54 **** 0 or 1. */ /* { dg-final { scan-tree-dump-times "\[xy\]\[^ \]* !=" 0 "vrp1" } } */ ! /* This one needs more copy propagation that only happens in dom1. */ ! /* { dg-final { scan-tree-dump-times "x\[^ \]* & y" 1 "dom1" { xfail *-*-* } } } */ ! /* { dg-final { scan-tree-dump-times "x\[^ \]* & y" 1 "dom2" } } */ ! /* { dg-final { scan-tree-dump-times "x\[^ \]* & y" 1 "vrp1" { xfail *-*-* } } } */ ! ! /* These two are fully simplified by VRP. */ /* { dg-final { scan-tree-dump-times "x\[^ \]* \[|\] y" 1 "vrp1" } } */ /* { dg-final { scan-tree-dump-times "x\[^ \]* \\^ 1" 1 "vrp1" } } */ /* { dg-final { cleanup-tree-dump "vrp1" } } */ /* { dg-final { cleanup-tree-dump "dom1" } } */ ! /* { dg-final { cleanup-tree-dump "dom2" } } */ --- 40,53 ---- 0 or 1. */ /* { dg-final { scan-tree-dump-times "\[xy\]\[^ \]* !=" 0 "vrp1" } } */ ! /* These two are fully simplified by VRP1. */ /* { dg-final { scan-tree-dump-times "x\[^ \]* \[|\] y" 1 "vrp1" } } */ /* { dg-final { scan-tree-dump-times "x\[^ \]* \\^ 1" 1 "vrp1" } } */ + /* VRP2 gets rid of the remaining & 1 operations, x and y are always + either 0 or 1. */ + /* { dg-final { scan-tree-dump-times " & 1;" 0 "vrp2" } } */ + /* { dg-final { cleanup-tree-dump "vrp1" } } */ /* { dg-final { cleanup-tree-dump "dom1" } } */ ! /* { dg-final { cleanup-tree-dump "vrp2" } } */ Index: gcc/testsuite/c-c++-common/uninit-17.c =================================================================== *** gcc/testsuite/c-c++-common/uninit-17.c.orig 2010-09-10 11:48:44.000000000 +0200 --- gcc/testsuite/c-c++-common/uninit-17.c 2013-03-18 14:38:09.030239733 +0100 *************** static void bar(int a, int *ptr) *** 11,19 **** { int b; /* { dg-message "declared" } */ if (b < 40) { ! ptr[0] = b; } ! b += 1; /* { dg-warning "may be used uninitialized" } */ ptr++; } while (--a != 0); --- 11,19 ---- { int b; /* { dg-message "declared" } */ if (b < 40) { ! ptr[0] = b; /* { dg-warning "may be used uninitialized" } */ } ! b += 1; ptr++; } while (--a != 0);