[llvm] [InstCombine] Added optimisation for trunc (Pow2 >> x) to i1 (PR #157030)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 7 07:36:47 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
----------------
dtcxzyw wrote:
It should be log2.
https://github.com/llvm/llvm-project/pull/157030
More information about the llvm-commits
mailing list