[PATCH] Fix loop optimization bug

Eric Botcazou ebotcazou@adacore.com
Mon Oct 6 13:19:00 GMT 2008


Hi,

this is a regression present at -O2 on the mainline and 4.3 branch.  For the 
attached testcase, ivopts takes the address of something like
  VIEW_CONVERT_EXPR <PLUS_EXPR <..,..>>
which results in the creation of a temporary and thus wrong code.

Fixed by teaching may_be_nonaddressable_p about this problematic case.  Tested 
on i586-suse-linux, OK for mainline and 4.3 branch?


2008-10-06  Eric Botcazou  <ebotcazou@adacore.com>

	* tree-ssa-loop-ivopts.c (may_be_nonaddressable_p): Return true for
	binary and comparison expressions.


2008-10-06  Eric Botcazou  <ebotcazou@adacore.com>

        * gnat.dg/loop_optimization4.adb: New test.
	* gnat.dg/loop_optimization4_pkg.ad[sb]: New helper.


-- 
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.diff
Type: text/x-diff
Size: 725 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20081006/ec2e15c9/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: loop_optimization4.adb
Type: text/x-adasrc
Size: 162 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20081006/ec2e15c9/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: loop_optimization4_pkg.adb
Type: text/x-adasrc
Size: 461 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20081006/ec2e15c9/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: loop_optimization4_pkg.ads
Type: text/x-adasrc
Size: 265 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20081006/ec2e15c9/attachment-0003.bin>


More information about the Gcc-patches mailing list