[Bug rtl-optimization/49028] Missed optimization of pointer arithmetic

piotr.wyderski at gmail dot com gcc-bugzilla@gcc.gnu.org
Wed May 18 13:15:00 GMT 2011


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

--- Comment #3 from Piotr Wyderski <piotr.wyderski at gmail dot com> 2011-05-18 12:02:58 UTC ---
(In reply to comment #2)

> Maybe we can do some generic clever tricks to (A /[ex] CST1) % CST2?
> We'd like to re-associate it somehow.

Wouldn't it be possible to do add the following subtree replacement rule?

           *            %
          / \          / \
         %   B        A   *
        / \      =>      / \
       / \ C            B   C
      A   B

It works in contexts where it can be proven that for_all a.(a % b) == 0,
which by definition includes b-aligned pointers.



More information about the Gcc-bugs mailing list