This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/55190] [SH] ivopts causes loop setup bloat
- From: "amker.cheng at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 30 Sep 2013 07:15:57 +0000
- Subject: [Bug rtl-optimization/55190] [SH] ivopts causes loop setup bloat
- Auto-submitted: auto-generated
- References: <bug-55190-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55190
bin.cheng <amker.cheng at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |amker.cheng at gmail dot com
--- Comment #3 from bin.cheng <amker.cheng at gmail dot com> ---
ARM can benefit from doloop structure too, but it is implemented in different
way. ARM backend defines special addsi_compare pattern and let combine pass
combine decrement and comparison instruction, thus saving the comparison
instruction.
IVOPT can be improved to select two iv candidates for the example loop, with
auto-increment one for the memory access and decrement one for loop exit check.
This is especially good for target supports both doloop and auto-increment
instructions like ARM and SH.
BUT most hand-written loops have incremental basic iv, so IVOPT depends on
previous pass ivcanon to rewrite it into decremental iv, like below:
for (i = 0; i < 100; i++)
//loop body
---->
for (i = 100; i > 0; i--)
//modified loop body
Unfortunately, ivcanon pass only do such loop transformation for loop which
iterates constant number times.
It seems difficult for RTL loop passes to revert decision made by IVOPT, so I
think it should be done in GIMPLE IVOPT. I will give it a try.
Thanks.