[PATCH] D30474: [InstCombine] Always Fold GEP chains where the first index is zero

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 28 15:02:54 PST 2017


efriedma added a comment.

I'd like to be a bit cautious about making changes here.  The transform in question is essentially duplicating code: "y = gep(x, i); z =gep(y, 0, j)" is two mul and two add operations; "y = gep(x, i); z =gep(x, i, j)" is three mul and three add operations.  So making it more aggressive could hurt performance in some cases.

I haven't really thought through what we should be doing here, but the right fix is probably more than just rearranging the code.


https://reviews.llvm.org/D30474





More information about the llvm-commits mailing list