[PATCH] D51112: [ValueTracking] Teach computeNumSignBits to understand min/max clamp patterns with constant/splat values
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 22 12:10:13 PDT 2018
efriedma added a comment.
> I'm not entirely sure if we can assume the constant is canonicalized to the RHS.
Instcombine does this in canonicalizeMinMaxWithConstant if the compare has one use. Probably good enough.
> Should the depth limit be bumped by 2 since we went through 2 nodes?
Bumping by 1 should be fine given the pattern-matching is cheap; the point of the depth limit is just to prevent non-linear compile-time, anyway.
----
Can you factor out the clamp matching into a separate helper?
================
Comment at: lib/Analysis/ValueTracking.cpp:2385
+
+ if (CLow->sle(*CHigh)) {
+ Tmp = ComputeNumSignBits(LHS2, Depth + 1, Q);
----------------
CLow and CHigh have to be constants so you can perform this "sle" check?
https://reviews.llvm.org/D51112
More information about the llvm-commits
mailing list