[Ada] Fix simple missed optimization

Eric Botcazou ebotcazou@adacore.com
Mon Nov 30 11:51:00 GMT 2015


It turns out that the previous patch is a fix for recent code added to gigi in 
order to optimize away more redundant checks in loop, but this code doesn't 
work for the very simple loop in the testcase.

Fixed thusly, tested on x86_64-suse-linux, applied on the mainline.


2015-11-30  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc-interface/gigi.h (is_simple_additive_expression): Declare.
	* gcc-interface/trans.c (struct range_check_info_d): Add DISP and
	NEG_P fields.
	(find_loop_for): Add DISP and NEG_P parameters with default value.
	Call is_simple_additive_expression to handle additive expressions.
	(Loop_Statement_to_gnu): Deal with displacement in range checks.
	(Raise_Error_to_gnu): Likewise.
	(gnat_to_gnu): Add call to find_loop_for.
	(is_simple_additive_expression): New function extracted from...
	(gnat_invariant_expr): ...here.  Call it on the expression.


2015-11-30  Eric Botcazou  <ebotcazou@adacore.com>

	* gnat.dg/loop_optimization22.adb: Add final scan.

-- 
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.diff
Type: text/x-patch
Size: 9136 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20151130/9ec36e78/attachment.bin>


More information about the Gcc-patches mailing list