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][rework]Improve loop bound info by simplifying conversions in iv base


Hi,
This is a rework for
https://gcc.gnu.org/ml/gcc-patches/2015-07/msg02335.html, with review
comments addressed.  For now, SCEV may compute iv base in the form of
"(signed T)((unsigned T)base + step))".  This complicates other
optimizations/analysis depending on SCEV because it's hard to dive into type
conversions.  This kind of type conversions can be simplified with
additional range information implied by loop initial conditions.  This patch
does such simplification.
With simplified iv base, loop niter analysis can compute more accurate bound
information since sensible value range can be derived for "base+step".  For
example, accurate loop bound&may_be_zero information is computed for cases
added by this patch.

The code is actually moved from loop_exits_before_overflow.  After this
patch, the corresponding code in loop_exits_before_overflow will be never
executed, so I removed that part code.  The patch also includes some code
format changes.

Bootstrap and test on x86_64.  Is it OK?

Thanks,
bin

2015-08-27  Bin Cheng  <bin.cheng@arm.com>

	* tree-ssa-loop-niter.c (tree_simplify_using_condition_1): Support
	new parameter.
	(tree_simplify_using_condition): Ditto.
	(simplify_using_initial_conditions): Ditto.
	(loop_exits_before_overflow): Pass new argument to function
	simplify_using_initial_conditions.  Remove case for type conversions
	simplification.
	* tree-ssa-loop-niter.h (simplify_using_initial_conditions): New
	parameter.
	* tree-scalar-evolution.c (simple_iv): Simplify type conversions
	in iv base using loop initial conditions.

gcc/testsuite/ChangeLog
2015-08-27  Bin Cheng  <bin.cheng@arm.com>

	* gcc.dg/tree-ssa/loop-bound-2.c: New test.
	* gcc.dg/tree-ssa/loop-bound-4.c: New test.
	* gcc.dg/tree-ssa/loop-bound-6.c: New test.

Attachment: simplify-iv_base-using-loop-initial-conditions-20150825.txt
Description: Text document


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