diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-01-31 09:00:54 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-01-31 09:00:54 +0000 |
commit | 56dfa44a46a8cb654cb8f977c2f4de8b55106a57 (patch) | |
tree | d6aeb452f86b1642240ab74d863ba99b6bd83792 | |
parent | 5789f1f82430087fe0a479641b5fcb81b275c5dd (diff) | |
download | gcc-56dfa44a46a8cb654cb8f977c2f4de8b55106a57.tar.gz |
2013-01-31 Richard Biener <rguenther@suse.de>
PR middle-end/53073
* common.opt (faggressive-loop-optimizations): New flag,
enabled by default.
* doc/invoke.texi (faggressive-loop-optimizations): Document.
* tree-ssa-loop-niter.c (estimate_numbers_of_iterations_loop): Guard
infer_loop_bounds_from_undefined by it.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@195610 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/common.opt | 4 | ||||
-rw-r--r-- | gcc/doc/invoke.texi | 13 | ||||
-rw-r--r-- | gcc/tree-ssa-loop-niter.c | 3 |
4 files changed, 27 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b09bce00464..a8d2d640ed3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,14 @@ 2013-01-31 Richard Biener <rguenther@suse.de> + PR middle-end/53073 + * common.opt (faggressive-loop-optimizations): New flag, + enabled by default. + * doc/invoke.texi (faggressive-loop-optimizations): Document. + * tree-ssa-loop-niter.c (estimate_numbers_of_iterations_loop): Guard + infer_loop_bounds_from_undefined by it. + +2013-01-31 Richard Biener <rguenther@suse.de> + PR tree-optimization/56150 * tree-ssa-loop-manip.c (find_uses_to_rename_stmt): Do not visit virtual operands. diff --git a/gcc/common.opt b/gcc/common.opt index 50255d8ee31..b6592e09aaa 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -792,6 +792,10 @@ Driver Undocumented fabi-version= Common Joined RejectNegative UInteger Var(flag_abi_version) Init(2) +faggressive-loop-optimizations +Common Report Var(flag_aggressive_loop_optimizations) Optimization Init(1) +Aggressively optimize loops using language constraints + falign-functions Common Report Var(align_functions,0) Optimization UInteger Align the start of functions diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 7d964677630..ef06b0b2851 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -349,7 +349,8 @@ Objective-C and Objective-C++ Dialects}. @item Optimization Options @xref{Optimize Options,,Options that Control Optimization}. -@gccoptlist{-falign-functions[=@var{n}] -falign-jumps[=@var{n}] @gol +@gccoptlist{-faggressive-loop-optimizations -falign-functions[=@var{n}] @gol +-falign-jumps[=@var{n}] @gol -falign-labels[=@var{n}] -falign-loops[=@var{n}] @gol -fassociative-math -fauto-inc-dec -fbranch-probabilities @gol -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol @@ -6988,6 +6989,16 @@ When @option{-fgcse-after-reload} is enabled, a redundant load elimination pass is performed after reload. The purpose of this pass is to clean up redundant spilling. +@item -faggressive-loop-optimizations +@opindex faggressive-loop-optimizations +This option tells the loop optimizer to use language constraints to +derive bounds for the number of iterations of a loop. This assumes that +loop code does not invoke undefined behavior by for example causing signed +integer overflows or out-of-bound array accesses. The bounds for the +number of iterations of a loop are used to guide loop unrolling and peeling +and loop exit test optimizations. +This option is enabled by default. + @item -funsafe-loop-optimizations @opindex funsafe-loop-optimizations This option tells the loop optimizer to assume that loop indices do not diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c index 2d93462b550..7ba7416f37a 100644 --- a/gcc/tree-ssa-loop-niter.c +++ b/gcc/tree-ssa-loop-niter.c @@ -3336,7 +3336,8 @@ estimate_numbers_of_iterations_loop (struct loop *loop) } exits.release (); - infer_loop_bounds_from_undefined (loop); + if (flag_aggressive_loop_optimizations) + infer_loop_bounds_from_undefined (loop); discover_iteration_bound_by_body_walk (loop); |