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

Artur Pilipenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 12 02:59:02 PST 2022


apilipenko added inline comments.


================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:11244
+                                                    const SCEV *FoundRHS) {
+  // Canonicalize comparisons.
+  if (RHS == FoundRHS) {
----------------
Could you please outline the implication rule you are about to use here? Otherwise, it's not clear why you need this canonicalization. 


================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:11263
+    auto *ShifteeS = getSCEV(Shiftee);
+    // LHS < (shiftee >> shiftvalue) <= shiftee <= RHS ---> x < RHS.
+    if (Pred == ICmpInst::ICMP_ULT || Pred == ICmpInst::ICMP_ULE)
----------------
I find this comment cryptic (maybe this is because I'm not familiar with the lingo of the SCEV implication engine). I think what you meant here is:
```
LHS <u (shiftee >> shiftvalue) && shiftee <=u RHS ---> x <u RHS
LHS <=u (shiftee >> shiftvalue) && shiftee <=u RHS ---> x <=u RHS
LHS <s (shiftee >> shiftvalue) && shiftee >= 0 && shiftee <=s RHS ---> x <s RHS
LHS <=s (shiftee >> shiftvalue) && shiftee >= 0 && shiftee <=s RHS ---> x <=s RHS
```


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

https://reviews.llvm.org/D116150



More information about the llvm-commits mailing list