[llvm] [InstCombine] Added optimisation for trunc (Pow2 >> x) to i1 (PR #157030)

via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 7 13:00:59 PDT 2025


================
@@ -969,6 +971,27 @@ Instruction *InstCombinerImpl::visitTrunc(TruncInst &Trunc) {
     Changed = true;
   }
 
+  const APInt *C1;
+  Value *V1;
+  // trunc (lshr i8 C1, V1) to i1 -> icmp eq V1, sqrt(C1) iff C1 is power of 2
----------------
kper wrote:

ah yes, thank you
stupid mistake

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


More information about the llvm-commits mailing list