[ValueTracking] Apply the isKnownNonZero techniques in `ashr`/`lshl` to `shl` and vice-versa
For all shifts we can apply the same two optimizations. 1) `ShiftOp(KnownVal.One, Max(KnownCnt)) != 0` -> result is non-zero 2) If already known `Val != 0` and we only shift out zeros (based on `Max(KnownCnt)`) -> result is non-zero The former exists for `shl` and the latter (for constant `Cnt`) exists for `ashr`/`lshr`. This patch improves the latter to use `Max(KnownCnt)` instead of relying on a constant shift `Cnt` and applies both techniques for all shift ops. Reviewed By: nikic Differential Revision: https://reviews.llvm.org/D148404
Loading
Please sign in to comment