This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH GCC]Remove support for -funsafe-loop-optimizations


Hi,
This patch removes support for -funsafe-loop-optimizations, as well as -Wunsafe-loop-optimizations.  By its name, this option does unsafe optimizations by assuming all loops must terminate and doesn't wrap.  Unfortunately, it's not as useful as expected because:
1) Simply assuming loop must terminate isn't enough.  What we really want is to analyze scalar evolution and loop niter bound under such assumptions.  This option does nothing in this aspect.
2) IIRC, this option generates bogus code for some common programs, that's why it's disabled by default even at Ofast level.

After I sent patches handling possible infinite loops in both (scev/niter) analyzer and vectorizer, it's a natural step to remove such options in GCC.  This patch does so by deleting code for -funsafe-loop-optimizations, as well as -Wunsafe-loop-optimizations.  It also deletes the two now useless tests, while the option interface is preserved for backward compatibility purpose.

Bootstrap and test on x86_64.  Is it OK?

Thanks,
bin

2016-07-14  Bin Cheng  <bin.cheng@arm.com>

	* common.opt (funsafe-loop-optimizations): Mark ignore.
	(Wunsafe-loop-optimizations): Ditto.
	* doc/invoke.texi (funsafe-loop-optimizations): Remove.
	(Wunsafe-loop-optimizations): Ditto.
	* loop-iv.c (get_simple_loop_desc): Remove support for
	funsafe-loop-optimizations.
	* tree-ssa-loop-niter.h (number_of_iterations_exit): Remove param.
	* tree-ssa-loop-niter.c (number_of_iterations_exit): Remove param.
	(finite_loop_p): Remove support for funsafe-loop-optimizations.
	(find_loop_niter): Remove arg for number_of_iterations_exit call.
	(estimate_numbers_of_iterations_loop): Ditto.
	* ipa-inline-analysis.c (estimate_function_body_sizes): Ditto.
	* predict.c (predict_loops): Ditto.
	* tree-parloops.c (try_get_loop_niter): Ditto.
	* tree-scalar-evolution.c (number_of_latch_executions): Ditto.
	* tree-ssa-loop-ivcanon.c (remove_redundant_iv_tests): Ditto.
	* tree-ssa-loop-ivopts.c (niter_for_exit): Ditto.
	* tree-ssa-loop-manip.c (can_unroll_loop_p): Ditto.

gcc/testsuite/ChangeLog
2016-07-14  Bin Cheng  <bin.cheng@arm.com>

	* gcc.dg/tree-ssa/pr19210-1.c: Delete.
	* gcc.dg/tree-ssa/pr19210-2.c: Delete.

Attachment: remove-unsafe-loop-optimizations-20160713.txt
Description: remove-unsafe-loop-optimizations-20160713.txt


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]