[llvm] r191090 - InstCombine: Canonicalize (gep i8* X, -(ptrtoint Y)) to (sub (ptrtoint X), (ptrtoint Y))

Eli Friedman eli.friedman at gmail.com
Fri Sep 20 11:59:05 PDT 2013

On Fri, Sep 20, 2013 at 7:38 AM, Benjamin Kramer
<benny.kra at googlemail.com>wrote:

> Author: d0k
> Date: Fri Sep 20 09:38:44 2013
> New Revision: 191090
> URL: http://llvm.org/viewvc/llvm-project?rev=191090&view=rev
> Log:
> InstCombine: Canonicalize (gep i8* X, -(ptrtoint Y)) to (sub (ptrtoint X),
> (ptrtoint Y))
> The GEP pattern is what SCEV expander emits for "ugly geps". The latter is
> what
> you get for pointer subtraction in C code. The rest of instcombine already
> knows how to deal with that so just canonicalize on that.
Is this really a good idea?  We lose aliasing information from turning the
GEP into a sub, and it seems like it could easily trigger on regular C++
code.  (If the only user of the GEP is a ptrtoint, it's a different story,
but you're not checking that.)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130920/d8d2115e/attachment.html>

More information about the llvm-commits mailing list