[llvm] [InstCombine] Generalize `icmp (shl nuw C2, Y), C -> icmp Y, C3` (PR #104696)

via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 17 08:13:21 PDT 2024


================
@@ -2251,9 +2257,9 @@ static Instruction *foldICmpShlOne(ICmpInst &Cmp, Instruction *Shl,
         Pred = ICmpInst::ICMP_UGT;
     }
 
-    unsigned CLog2 = C.logBase2();
+    unsigned CLog2 = Div.logBase2();
----------------
goldsteinn wrote:

Can you add a test where `C` and `C2` are not a power of two and we need to roundup the log? I.e
`(48 << X) u>= 144`?

I don't see the ceil logic for that case.

https://github.com/llvm/llvm-project/pull/104696


More information about the llvm-commits mailing list