[Bug middle-end/43866] [4.3/4.4/4.5/4.6 Regression] wrong code with -fbounds-check -funswitch-loops

jakub at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Fri Jun 25 08:13:00 GMT 2010



------- Comment #15 from jakub at gcc dot gnu dot org  2010-06-25 08:13 -------
Created an attachment (id=21000)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21000&action=view)
gcc46-pr43866.patch

Here is a complete fix.

This includes what the earlier two patches did, plus for nested
tree_unswitch_single_loop call in the first pass optimizes all conditions using
entry tests, then if there are some possible unswitching condition candidates
does a still reachable loop bb discovery and only considers bbs in still
unreachable bbs.

Not copying the unreachable blocks would be IMHO harder.  The current pass was
trying to be very simple, not modify the original loop, just duplicate it and
add a guard condition in front of the two loops, then in the nested call just
simplify conditions using the entry checks and leave all the cleanups to cfg
cleanup after the pass (e.g. to avoid redoing loop discovery etc.).

With the patch pr43866.s is actually smaller, eventhough more loops are
unswitched (previously some of the 15 unswitched loops were on 0 != 0 or 1 != 0
conditions and thus thrown away immediately).


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #20997|0                           |1
        is obsolete|                            |
  Attachment #20998|0                           |1
        is obsolete|                            |
         AssignedTo|unassigned at gcc dot gnu   |jakub at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43866



More information about the Gcc-bugs mailing list