[llvm] InstCombine: Try to fold ldexp with select of power operand (PR #97354)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 2 01:28:26 PDT 2024


================
@@ -2641,6 +2641,31 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
       return BinaryOperator::CreateFMulFMF(Src, Select, II);
     }
 
+    // ldexp(x, c ? exp : 0) -> c ? ldexp(x, exp) : x
+    // ldexp(x, c ? 0 : exp) -> c ? x : ldexp(x, exp)
+    ///
----------------
dtcxzyw wrote:

Anyway, I have no objections since it is the right canonicalization as we already did for other fp intrinsics.


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


More information about the llvm-commits mailing list