[llvm] [PartiallyInlineLibCalls] Emit missed- and passed-optimization remarks when partially inlining sqrt (PR #123966)

Tibor Győri via llvm-commits llvm-commits at lists.llvm.org
Sun May 18 09:58:48 PDT 2025


================
@@ -56,6 +56,20 @@ static bool optimizeSQRT(CallInst *Call, Function *CalledFunc,
   // dst = phi(v0, v1)
   //
 
+  ORE->emit([&]() {
+    return OptimizationRemark(DEBUG_TYPE, "SqrtPartiallyInlined",
+                              Call->getDebugLoc(), &CurrBB)
+           << "Partially inlined call to sqrt function despite having to use "
+              "errno for error handling: target has fast sqrt instruction";
+  });
+  ORE->emit([&]() {
+    return OptimizationRemarkMissed(DEBUG_TYPE, "BranchInserted",
+                                    Call->getDebugLoc(), &CurrBB)
+           << "Branch to library sqrt fn had to be inserted to satisfy the "
+              "current target's requirement for math functions to set errno on "
----------------
TiborGY wrote:

Hmm, target may not be the best word for it indeed, but [the docs](https://clang.llvm.org/docs/UsersManual.html#controlling-floating-point-behavior) are using a similar language:

> On some targets, math library functions never set errno, and so -fno-math-errno is the default. This includes most BSD-derived systems, including Darwin.

In guess I could say target triplet instead of target?

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


More information about the llvm-commits mailing list