[PATCH] D28625: [InstCombine] try to shrink bitwise logic with phi operand
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 22 11:36:24 PST 2017
spatel added a comment.
In https://reviews.llvm.org/D28625#650747, @efriedma wrote:
> int array_max(int n, char *p) {
>
> int result = 0;
> for (int i = 0; i < n; ++i)
> result = result > p[i] ? result : p[i];
> return result;
This case falls into the "don't break min/max" hole that thwarts all kinds of optimization...sigh. Ie, we have something like this in at least 5 places in InstCombine:
// If this is a select as part of a min/max pattern, don't simplify any
// further in case we break the structure.
Also, there's no bitwise logic here. We'd need to enhance select folding to catch it separately from this patch, or this is a good reason to pursue a more general SimplifyDemandedBits solution.
https://reviews.llvm.org/D28625
More information about the llvm-commits
mailing list