[llvm] [SimplifyLibCalls] Merge sqrt into the power of exp (PR #79146)

Anton Sidorenko via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 31 02:13:54 PST 2024


================
@@ -2538,6 +2538,70 @@ Value *LibCallSimplifier::optimizeLog(CallInst *Log, IRBuilderBase &B) {
   return Ret;
 }
 
+// sqrt(exp(X)) -> exp(X * 0.5)
+Value *LibCallSimplifier::mergeSqrtToExp(CallInst *CI, IRBuilderBase &B) {
+  if (!CI->isFast())
----------------
asi-sc wrote:

@arsenm, thanks for the research. I've changed the code to check only reassoc flag.

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


More information about the llvm-commits mailing list