re PR tree-optimization/23286 (Missed code hoisting optimization)
authorSteven Bosscher <steven@gcc.gnu.org>
Tue, 12 Jul 2016 13:32:04 +0000 (13:32 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 12 Jul 2016 13:32:04 +0000 (13:32 +0000)
commit37ccb0bacb7bddf5ca7b874d48ac761dfcf9a25d
tree6abcd421d94eda4e2087e401999ef351607df2c7
parent1de3c940d8782eae7739a6c6f7327e99eee63cce
re PR tree-optimization/23286 (Missed code hoisting optimization)

2016-07-12  Steven Bosscher  <steven@gcc.gnu.org>
Richard Biener  <rguenther@suse.de>

PR tree-optimization/23286
PR tree-optimization/70159
* doc/invoke.texi: Document -fcode-hoisting.
* common.opt (fcode-hoisting): New flag.
* opts.c (default_options_table): Enable -fcode-hoisting at -O2+.
* tree-ssa-pre.c (pre_stats): Add hoist_insert.
(do_regular_insertion): Rename to ...
(do_pre_regular_insertion): ... this and amend general comments
on insertion strathegy.
(do_partial_partial_insertion): Rename to ...
(do_pre_partial_partial_insertion): ... this.
(do_hoist_insertion): New function.
(insert_aux): Take flags on whether to do PRE and/or hoist insertion
and call do_hoist_insertion properly.
(insert): Adjust.
(pass_pre::gate): Enable also if -fcode-hoisting is enabled.
(pass_pre::execute): Register hoist_insert stats.

* gcc.dg/tree-ssa/ssa-pre-11.c: Disable code hosting.
* gcc.dg/tree-ssa/ssa-pre-27.c: Likewise.
* gcc.dg/tree-ssa/ssa-pre-28.c: Likewise.
* gcc.dg/tree-ssa/ssa-pre-2.c: Likewise.
* gcc.dg/tree-ssa/pr35286.c: Likewise.
* gcc.dg/tree-ssa/pr35287.c: Likewise.
* gcc.dg/hoist-register-pressure-1.c: Likewise.
* gcc.dg/hoist-register-pressure-2.c: Likewise.
* gcc.dg/hoist-register-pressure-3.c: Likewise.
* gcc.dg/pr51879-12.c: Likewise.
* gcc.dg/strlenopt-9.c: Likewise.
* gcc.dg/tree-ssa/pr47392.c: Likewise.
* gcc.dg/tree-ssa/pr68619-4.c: Likewise.
* gcc.dg/tree-ssa/split-path-5.c: Likewise.
* gcc.dg/tree-ssa/slsr-35.c: Likewise.
* gcc.dg/tree-ssa/slsr-36.c: Likewise.
* gcc.dg/tree-ssa/loadpre3.c: Adjust so hosting doesn't apply.
* gcc.dg/tree-ssa/pr43491.c: Scan optimized dump for desired result.
* gcc.dg/tree-ssa/ssa-pre-31.c: Adjust expected outcome for hoisting.
* gcc.dg/tree-ssa/ssa-hoist-1.c: New testcase.
* gcc.dg/tree-ssa/ssa-hoist-2.c: New testcase.
* gcc.dg/tree-ssa/ssa-hoist-3.c: New testcase.
* gcc.dg/tree-ssa/ssa-hoist-4.c: New testcase.
* gcc.dg/tree-ssa/ssa-hoist-5.c: New testcase.
* gcc.dg/tree-ssa/ssa-hoist-6.c: New testcase.
* gfortran.dg/pr43984.f90: Adjust expected outcome.

Co-Authored-By: Richard Biener <rguenther@suse.de>
From-SVN: r238242
30 files changed:
gcc/ChangeLog
gcc/common.opt
gcc/doc/invoke.texi
gcc/opts.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/hoist-register-pressure-1.c
gcc/testsuite/gcc.dg/hoist-register-pressure-2.c
gcc/testsuite/gcc.dg/hoist-register-pressure-3.c
gcc/testsuite/gcc.dg/pr51879-12.c
gcc/testsuite/gcc.dg/strlenopt-9.c
gcc/testsuite/gcc.dg/tree-ssa/loadpre3.c
gcc/testsuite/gcc.dg/tree-ssa/pr35286.c
gcc/testsuite/gcc.dg/tree-ssa/pr35287.c
gcc/testsuite/gcc.dg/tree-ssa/pr43491.c
gcc/testsuite/gcc.dg/tree-ssa/pr47392.c
gcc/testsuite/gcc.dg/tree-ssa/pr68619-4.c
gcc/testsuite/gcc.dg/tree-ssa/slsr-35.c
gcc/testsuite/gcc.dg/tree-ssa/slsr-36.c
gcc/testsuite/gcc.dg/tree-ssa/ssa-hoist-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/ssa-hoist-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/ssa-hoist-3.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/ssa-hoist-4.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/ssa-hoist-6.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-11.c
gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-2.c
gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-27.c
gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-28.c
gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-31.c
gcc/testsuite/gfortran.dg/pr43984.f90
gcc/tree-ssa-pre.c