[PATCH] D116150: [SCEV] Use lshr in implications

Artur Pilipenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 18 17:18:31 PST 2022


apilipenko added inline comments.


================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:11496-11505
+    // Given shiftee >= 0, prove one of the following:
+    // LHS <u (shiftee >> shiftvalue) && shiftee <=u RHS ---> LHS <u RHS
+    // LHS <=u (shiftee >> shiftvalue) && shiftee <=u RHS ---> LHS <=u RHS
+    // LHS <s (shiftee >> shiftvalue) && shiftee <=s RHS ---> LHS <s RHS
+    // LHS <=s (shiftee >> shiftvalue) && shiftee <=s RHS ---> LHS <=s RHS
+    if (Pred == ICmpInst::ICMP_ULT || Pred == ICmpInst::ICMP_ULE)
+      return isKnownPredicate(ICmpInst::ICMP_ULE, ShifteeS, RHS);
----------------
Looking better, but now there is a mismatch between the code and the comment. You don't check for isKnownNonNegative for unsigned predicates, but the comment suggest that this is a precondition for all cases.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116150/new/

https://reviews.llvm.org/D116150



More information about the llvm-commits mailing list