[llvm] [InstCombine] Convert fshl(x, 0, y) to shl(x, and(y, BitWidth - 1)) when BitWidth is pow2 (PR #122362)

Amr Hesham via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 11 01:11:20 PST 2025


================
@@ -2229,6 +2229,14 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
         return BitOp;
     }
 
+    // fshl(X, 0, Y) --> shl(X, and(Y, BitWidth - 1)) if bitwidth is a
+    // power-of-2
+    if (isPowerOf2_32(BitWidth) && match(Op1, m_ZeroInt())) {
----------------
AmrDeveloper wrote:

Yes, you are right, i will add a check and update tests

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


More information about the llvm-commits mailing list