Re: [PATCH][2/2] Make SCCVN use conditional equivalences
Andreas Schwab sch...@suse.de writes: On ia64 and arm64: FAIL: g++.dg/tree-ssa/pr61034.C -std=gnu++11 scan-tree-dump-times fre2 free 10 $ gcc/xg++ -Bgcc/ ../gcc/testsuite/g++.dg/tree-ssa/pr61034.C -nostdinc++ -Iia64-suse-linux/libstdc++-v3/include/ia64-suse-linux -Iia64-suse-linux/libstdc++-v3/include -I../libstdc++-v3/libsupc++ -I../libstdc++-v3/include/backward -I../libstdc++-v3/testsuite/util -std=gnu++11 -O3 -fdump-tree-fre2 -S -o pr61034.s $ grep -c free *.fre2 14 Same on sparc. Rainer -- - Rainer Orth, Center for Biotechnology, Bielefeld University
Re: [PATCH][2/2] Make SCCVN use conditional equivalences
Rainer Orth r...@cebitec.uni-bielefeld.de writes: Andreas Schwab sch...@suse.de writes: On ia64 and arm64: FAIL: g++.dg/tree-ssa/pr61034.C -std=gnu++11 scan-tree-dump-times fre2 free 10 $ gcc/xg++ -Bgcc/ ../gcc/testsuite/g++.dg/tree-ssa/pr61034.C -nostdinc++ -Iia64-suse-linux/libstdc++-v3/include/ia64-suse-linux -Iia64-suse-linux/libstdc++-v3/include -I../libstdc++-v3/libsupc++ -I../libstdc++-v3/include/backward -I../libstdc++-v3/testsuite/util -std=gnu++11 -O3 -fdump-tree-fre2 -S -o pr61034.s $ grep -c free *.fre2 14 Same on sparc. This is tracked in PR67203. Andreas. -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 And now for something completely different.
Re: [PATCH][2/2] Make SCCVN use conditional equivalences
On Wed, Aug 12, 2015 at 7:23 AM, Richard Biener rguent...@suse.de wrote: On Wed, 12 Aug 2015, Richard Biener wrote: This brings FRE/PRE up to the same level as DOM in being able to remove redundant conditionals. It does so by inserting temporary conditional expressions proved to be true on single predecessor edges. I've had to do a lot of testcase adjustments, thus the patch is now re-bootstrapping / testing on x86_64-unknown-linux-gnu. I've applied with a slight change, trimming down the number of equivalences recorded (basically only record anything off conditions not already optimized to go either way). Bootstrapped and tested on x86_64-unknown-linux-gnu, applied. Richard. 2015-08-12 Richard Biener rguent...@suse.de * tree-ssa-sccvn.c (vn_nary_op_compute_hash): Also canonicalize comparison operand order and commutative ternary op operand order. (sccvn_dom_walker::cond_stack): New state to track temporary expressions. (sccvn_dom_walker::after_dom_children): Remove tempoary expressions no longer valid. (sccvn_dom_walker::record_cond): Add a single temporary conditional expression. (sccvn_dom_walker::record_conds): Add a temporary conditional expressions and all related expressions also true/false. (sccvn_dom_walker::before_dom_children): Record temporary expressions based on the controlling condition of a single predecessor. When trying to simplify a conditional statement lookup expressions we might have inserted earlier. This caused: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67241 H.J.
Re: [PATCH][2/2] Make SCCVN use conditional equivalences
On Thu, 13 Aug 2015, Andreas Schwab wrote: On m68k: FAIL: gcc.dg/tree-ssa/vrp33.c scan-tree-dump vrp1 Folding predicate.*== 1 to 0 $ gcc/xgcc -B gcc/ ../gcc/testsuite/gcc.dg/tree-ssa/vrp33.c -O2 -fdump-tree-vrp1 -S $ grep -c Folding *.vrp1 0 I suppose for logical-op-non-short-circuit you need -fno-tree-fre for that testcase now (which shouldn't harm for other targets). Patch to add that pre-approved if it works. Richard.
Re: [PATCH][2/2] Make SCCVN use conditional equivalences
On m68k: FAIL: gcc.dg/tree-ssa/vrp33.c scan-tree-dump vrp1 Folding predicate.*== 1 to 0 $ gcc/xgcc -B gcc/ ../gcc/testsuite/gcc.dg/tree-ssa/vrp33.c -O2 -fdump-tree-vrp1 -S $ grep -c Folding *.vrp1 0 Andreas. -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 And now for something completely different.
Re: [PATCH][2/2] Make SCCVN use conditional equivalences
On ia64 and arm64: FAIL: g++.dg/tree-ssa/pr61034.C -std=gnu++11 scan-tree-dump-times fre2 free 10 $ gcc/xg++ -Bgcc/ ../gcc/testsuite/g++.dg/tree-ssa/pr61034.C -nostdinc++ -Iia64-suse-linux/libstdc++-v3/include/ia64-suse-linux -Iia64-suse-linux/libstdc++-v3/include -I../libstdc++-v3/libsupc++ -I../libstdc++-v3/include/backward -I../libstdc++-v3/testsuite/util -std=gnu++11 -O3 -fdump-tree-fre2 -S -o pr61034.s $ grep -c free *.fre2 14 Andreas. -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 And now for something completely different.
Re: [PATCH][2/2] Make SCCVN use conditional equivalences
Richard Biener rguent...@suse.de writes: On Thu, 13 Aug 2015, Andreas Schwab wrote: On m68k: FAIL: gcc.dg/tree-ssa/vrp33.c scan-tree-dump vrp1 Folding predicate.*== 1 to 0 $ gcc/xgcc -B gcc/ ../gcc/testsuite/gcc.dg/tree-ssa/vrp33.c -O2 -fdump-tree-vrp1 -S $ grep -c Folding *.vrp1 0 I suppose for logical-op-non-short-circuit you need -fno-tree-fre for that testcase now (which shouldn't harm for other targets). Yes, that works, and didn't change anything on ia64 or arm64. Andreas. * gcc.dg/tree-ssa/vrp33.c: Add -fno-tree-fre. diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp33.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp33.c index 8c8879b..75fefa4 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/vrp33.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp33.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options -O2 -fdump-tree-vrp1 } */ +/* { dg-options -O2 -fdump-tree-vrp1 -fno-tree-fre } */ /* This is from PR14052. */ -- 2.5.0 -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 And now for something completely different.
Re: [PATCH][2/2] Make SCCVN use conditional equivalences
On Thu, 13 Aug 2015, Andreas Schwab wrote: On ia64 and arm64: FAIL: g++.dg/tree-ssa/pr61034.C -std=gnu++11 scan-tree-dump-times fre2 free 10 $ gcc/xg++ -Bgcc/ ../gcc/testsuite/g++.dg/tree-ssa/pr61034.C -nostdinc++ -Iia64-suse-linux/libstdc++-v3/include/ia64-suse-linux -Iia64-suse-linux/libstdc++-v3/include -I../libstdc++-v3/libsupc++ -I../libstdc++-v3/include/backward -I../libstdc++-v3/testsuite/util -std=gnu++11 -O3 -fdump-tree-fre2 -S -o pr61034.s $ grep -c free *.fre2 14 Hmpf. I remember 2015-04-28 Jan Hubicka hubi...@ucw.cz * g++.dg/tree-ssa/pr61034.C: Add temporary; fix template. which managed to fix an inconsistency. I suppose that no longer works :/ Will try to investigate at some point - mind opening a bug for this one? Thanks, Richard.
Re: [PATCH][2/2] Make SCCVN use conditional equivalences
On Wed, 12 Aug 2015, Richard Biener wrote: This brings FRE/PRE up to the same level as DOM in being able to remove redundant conditionals. It does so by inserting temporary conditional expressions proved to be true on single predecessor edges. I've had to do a lot of testcase adjustments, thus the patch is now re-bootstrapping / testing on x86_64-unknown-linux-gnu. I've applied with a slight change, trimming down the number of equivalences recorded (basically only record anything off conditions not already optimized to go either way). Bootstrapped and tested on x86_64-unknown-linux-gnu, applied. Richard. 2015-08-12 Richard Biener rguent...@suse.de * tree-ssa-sccvn.c (vn_nary_op_compute_hash): Also canonicalize comparison operand order and commutative ternary op operand order. (sccvn_dom_walker::cond_stack): New state to track temporary expressions. (sccvn_dom_walker::after_dom_children): Remove tempoary expressions no longer valid. (sccvn_dom_walker::record_cond): Add a single temporary conditional expression. (sccvn_dom_walker::record_conds): Add a temporary conditional expressions and all related expressions also true/false. (sccvn_dom_walker::before_dom_children): Record temporary expressions based on the controlling condition of a single predecessor. When trying to simplify a conditional statement lookup expressions we might have inserted earlier. * testsuite/gcc.dg/tree-ssa/ssa-fre-47.c: New testcase. * testsuite/gcc.dg/tree-ssa/ssa-fre-48.c: Likewise. * testsuite/gcc.dg/tree-ssa/ssa-fre-49.c: Likewise. * testsuite/g++.dg/tree-ssa/pr61034.C: Adjust. * testsuite/gcc.dg/fold-compare-2.c: Likewise. * testsuite/gcc.dg/pr50763.c: Likewise. * testsuite/gcc.dg/predict-3.c: Likewise. * testsuite/gcc.dg/tree-ssa/20030709-2.c: Likewise. * testsuite/gcc.dg/tree-ssa/pr19831-3.c: Likewise. * testsuite/gcc.dg/tree-ssa/pr20657.c: Likewise. * testsuite/gcc.dg/tree-ssa/pr21001.c: Likewise. * testsuite/gcc.dg/tree-ssa/pr37508.c: Likewise. * testsuite/gcc.dg/tree-ssa/vrp04.c: Likewise. * testsuite/gcc.dg/tree-ssa/vrp07.c: Likewise. * testsuite/gcc.dg/tree-ssa/vrp09.c: Likewise. * testsuite/gcc.dg/tree-ssa/vrp16.c: Likewise. * testsuite/gcc.dg/tree-ssa/vrp20.c: Likewise. * testsuite/gcc.dg/tree-ssa/vrp25.c: Likewise. * testsuite/gcc.dg/tree-ssa/vrp87.c: Likewise. Index: gcc/testsuite/g++.dg/tree-ssa/pr61034.C === --- gcc/testsuite/g++.dg/tree-ssa/pr61034.C (revision 226802) +++ gcc/testsuite/g++.dg/tree-ssa/pr61034.C (working copy) @@ -43,5 +43,5 @@ bool f(I a, I b, I c, I d) { // This works only if everything is inlined into 'f'. // { dg-final { scan-tree-dump-times ;; Function 1 fre2 } } -// { dg-final { scan-tree-dump-times free 18 fre2 } } +// { dg-final { scan-tree-dump-times free 10 fre2 } } // { dg-final { scan-tree-dump-times unreachable 11 fre2 } } Index: gcc/testsuite/gcc.dg/fold-compare-2.c === --- gcc/testsuite/gcc.dg/fold-compare-2.c (revision 226802) +++ gcc/testsuite/gcc.dg/fold-compare-2.c (working copy) @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options -O2 -fno-tree-tail-merge -fdump-tree-vrp1 } */ +/* { dg-options -O2 -fdump-tree-fre1 } */ extern void abort (void); @@ -15,5 +15,5 @@ main(void) return 0; } -/* { dg-final { scan-tree-dump-times Removing basic block 2 vrp1 } } */ +/* { dg-final { scan-tree-dump-times Removing basic block 2 fre1 } } */ Index: gcc/testsuite/gcc.dg/pr50763.c === --- gcc/testsuite/gcc.dg/pr50763.c (revision 226802) +++ gcc/testsuite/gcc.dg/pr50763.c (working copy) @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options -O2 -ftree-tail-merge -fno-tree-dominator-opts -fdump-tree-pre } */ +/* { dg-options -O2 -ftree-tail-merge -fno-tree-dominator-opts } */ int bar (int i); @@ -11,5 +11,3 @@ foo (int c, int d) d = 33; while (c == d); } - -/* { dg-final { scan-tree-dump-times == 33 2 pre} } */ Index: gcc/testsuite/gcc.dg/predict-3.c === --- gcc/testsuite/gcc.dg/predict-3.c(revision 226802) +++ gcc/testsuite/gcc.dg/predict-3.c(working copy) @@ -12,6 +12,10 @@ void foo (int bound) { if (i bound - 2) global += bar (i); + /* The following test is redundant with the loop bound check in the + for stmt and thus eliminated by FRE which makes the controlled +stmt always executed and thus equivalent to 100%. Thus the +heuristic only applies three times. */ if (i = bound) global += bar (i); if (i + 1 bound)
[PATCH][2/2] Make SCCVN use conditional equivalences
This brings FRE/PRE up to the same level as DOM in being able to remove redundant conditionals. It does so by inserting temporary conditional expressions proved to be true on single predecessor edges. I've had to do a lot of testcase adjustments, thus the patch is now re-bootstrapping / testing on x86_64-unknown-linux-gnu. Richard. 2015-08-12 Richard Biener rguent...@suse.de * tree-ssa-sccvn.c (vn_nary_op_compute_hash): Also canonicalize comparison operand order and commutative ternary op operand order. (sccvn_dom_walker::cond_stack): New state to track temporary expressions. (sccvn_dom_walker::after_dom_children): Remove tempoary expressions no longer valid. (sccvn_dom_walker::record_cond): Add a single temporary conditional expression. (sccvn_dom_walker::record_conds): Add a temporary conditional expressions and all related expressions also true/false. (sccvn_dom_walker::before_dom_children): Record temporary expressions based on the controlling condition of a single predecessor. When trying to simplify a conditional statement lookup expressions we might have inserted earlier. * testsuite/g++.dg/tree-ssa/pr61034.C * testsuite/gcc.dg/fold-compare-2.c * testsuite/gcc.dg/pr50763.c * testsuite/gcc.dg/predict-3.c * testsuite/gcc.dg/tree-ssa/20030709-2.c * testsuite/gcc.dg/tree-ssa/pr19831-3.c * testsuite/gcc.dg/tree-ssa/pr20657.c * testsuite/gcc.dg/tree-ssa/pr21001.c * testsuite/gcc.dg/tree-ssa/pr37508.c * testsuite/gcc.dg/tree-ssa/ssa-fre-47.c * testsuite/gcc.dg/tree-ssa/ssa-fre-48.c * testsuite/gcc.dg/tree-ssa/ssa-fre-49.c * testsuite/gcc.dg/tree-ssa/vrp04.c * testsuite/gcc.dg/tree-ssa/vrp07.c * testsuite/gcc.dg/tree-ssa/vrp09.c * testsuite/gcc.dg/tree-ssa/vrp16.c * testsuite/gcc.dg/tree-ssa/vrp20.c * testsuite/gcc.dg/tree-ssa/vrp25.c * testsuite/gcc.dg/tree-ssa/vrp87.c Index: gcc/testsuite/g++.dg/tree-ssa/pr61034.C === --- gcc/testsuite/g++.dg/tree-ssa/pr61034.C (revision 226802) +++ gcc/testsuite/g++.dg/tree-ssa/pr61034.C (working copy) @@ -43,5 +43,5 @@ bool f(I a, I b, I c, I d) { // This works only if everything is inlined into 'f'. // { dg-final { scan-tree-dump-times ;; Function 1 fre2 } } -// { dg-final { scan-tree-dump-times free 18 fre2 } } +// { dg-final { scan-tree-dump-times free 10 fre2 } } // { dg-final { scan-tree-dump-times unreachable 11 fre2 } } Index: gcc/testsuite/gcc.dg/fold-compare-2.c === --- gcc/testsuite/gcc.dg/fold-compare-2.c (revision 226802) +++ gcc/testsuite/gcc.dg/fold-compare-2.c (working copy) @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options -O2 -fno-tree-tail-merge -fdump-tree-vrp1 } */ +/* { dg-options -O2 -fdump-tree-fre1 } */ extern void abort (void); @@ -15,5 +15,5 @@ main(void) return 0; } -/* { dg-final { scan-tree-dump-times Removing basic block 2 vrp1 } } */ +/* { dg-final { scan-tree-dump-times Removing basic block 2 fre1 } } */ Index: gcc/testsuite/gcc.dg/pr50763.c === --- gcc/testsuite/gcc.dg/pr50763.c (revision 226802) +++ gcc/testsuite/gcc.dg/pr50763.c (working copy) @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options -O2 -ftree-tail-merge -fno-tree-dominator-opts -fdump-tree-pre } */ +/* { dg-options -O2 -ftree-tail-merge -fno-tree-dominator-opts } */ int bar (int i); @@ -11,5 +11,3 @@ foo (int c, int d) d = 33; while (c == d); } - -/* { dg-final { scan-tree-dump-times == 33 2 pre} } */ Index: gcc/testsuite/gcc.dg/predict-3.c === --- gcc/testsuite/gcc.dg/predict-3.c(revision 226802) +++ gcc/testsuite/gcc.dg/predict-3.c(working copy) @@ -12,6 +12,10 @@ void foo (int bound) { if (i bound - 2) global += bar (i); + /* The following test is redundant with the loop bound check in the + for stmt and thus eliminated by FRE which makes the controlled +stmt always executed and thus equivalent to 100%. Thus the +heuristic only applies three times. */ if (i = bound) global += bar (i); if (i + 1 bound) @@ -21,4 +25,4 @@ void foo (int bound) } } -/* { dg-final { scan-tree-dump-times loop iv compare heuristics: 100.0% 4 profile_estimate} } */ +/* { dg-final { scan-tree-dump-times loop iv compare heuristics: 100.0% 3 profile_estimate} } */ Index: gcc/testsuite/gcc.dg/tree-ssa/20030709-2.c === --- gcc/testsuite/gcc.dg/tree-ssa/20030709-2.c (revision 226802) +++ gcc/testsuite/gcc.dg/tree-ssa/20030709-2.c (working copy) @@