[PATCH] D26525: [InstCombine] canonicalize min/max constant to select's false value
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 14 08:30:11 PST 2016
spatel added inline comments.
================
Comment at: lib/Transforms/InstCombine/InstCombineSelect.cpp:515-516
+ InstCombiner::BuilderTy &Builder) {
+ // TODO: We should also canonicalize min/max when the select has a different
+ // constant value than the cmp constant, but we need to fix the backend first.
+ if (!Cmp.hasOneUse() || !isa<Constant>(Cmp.getOperand(1)) ||
----------------
Ayal wrote:
> When the constant value of the select differs from that of the cmp, is it still considered min/max?
Yes - if you believe ValueTracking's (matchSelectPattern) definition of min/max. Eg:
// Look through 'not' ops to find disguised signed min/max.
// (X >s C) ? ~X : ~C ==> (~X <s ~C) ? ~X : ~C ==> SMIN(~X, ~C)
I recently (rL286772) moved obfuscated patterns like that to "matchMinMax()" if you want to see the full list of patterns that we currently recognize as min/max.
https://reviews.llvm.org/D26525
More information about the llvm-commits
mailing list