[llvm] [SimplifyLibCalls] Merge sqrt into the power of exp (PR #79146)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 30 00:30:18 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())
----------------
arsenm wrote:
I did some experiments and this is net error reducing. This reassociation avoids some intermediate overflows to infinity and overall reduces worst case ulp. I think just reassoc is adequate
https://github.com/llvm/llvm-project/pull/79146
More information about the llvm-commits
mailing list