[PATCH] [InstCombine] Don't fold a GEP into itself through a PHI node

Daniel Jasper djasper at google.com
Thu Mar 19 03:42:37 PDT 2015


On Thu, Mar 19, 2015 at 4:30 AM, Nick Lewycky <nicholas at mxc.ca> wrote:

> Daniel Jasper wrote:
>
> > Ping?
>
>
>
>
>   if (!Op2 || Op1->getNumOperands() != Op2->getNumOperands())
>     return nullptr;
>
> ‚Äč
> +   // As for Op1 above, don't try to fold a GEP into itself.
> +   if (Op2 == &GEP)
> +     return nullptr;
>
> Consider folding that into the check above.
>

I have (and actually had that in the first snapshot). However, IMO
separating it out makes the comment clearer and it should not have any
performance penalties.

>
> LGTM
>
> > http://reviews.llvm.org/D8245
>
> >
>
> > EMAIL PREFERENCES
>
> >
>
> >   http://reviews.llvm.org/settings/panel/emailpreferences/
>
> >
>
> > _______________________________________________
>
> >  llvm-commits mailing list
>
> >  llvm-commits at cs.uiuc.edu
>
> >  http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
>
> http://reviews.llvm.org/D8245
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150319/2670ad39/attachment.html>


More information about the llvm-commits mailing list