[llvm] [InstCombine] Fold mul (lshr exact (X, 2^N + 1)), N -> add (X , lshr (X, N)) (PR #95042)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 11 07:46:33 PDT 2024


================
@@ -255,6 +255,43 @@ Instruction *InstCombinerImpl::visitMul(BinaryOperator &I) {
     }
   }
 
+  {
+    // mul (lshr exact (X, 2^N + 1)), N -> add (X , lshr (X, N))
----------------
dtcxzyw wrote:

```suggestion
    // mul (lshr exact X, N), (2^N + 1) -> add (X , lshr (X, N))
```


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


More information about the llvm-commits mailing list