[clang] Don't emit int TBAA metadata on more complex FP math libcalls. (PR #107598)

Matt Arsenault via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 11 05:31:26 PDT 2024


================
@@ -699,9 +699,20 @@ static RValue emitLibraryCall(CodeGenFunction &CGF, const FunctionDecl *FD,
     bool ConstWithoutErrnoAndExceptions =
         Context.BuiltinInfo.isConstWithoutErrnoAndExceptions(BuiltinID);
     // Restrict to target with errno, for example, MacOS doesn't set errno.
-    // TODO: Support builtin function with complex type returned, eg: cacosh
+    bool CallWithPointerArgsOrPointerReturnType = false;
+    if (Call.isScalar() && Call.getScalarVal()) {
+      if (CallBase *CB = dyn_cast<CallBase>(Call.getScalarVal())) {
+        for (Value *A : CB->args())
+          if (A->getType()->isPointerTy())
+            CallWithPointerArgsOrPointerReturnType = true;
+        CallWithPointerArgsOrPointerReturnType =
+            CallWithPointerArgsOrPointerReturnType ||
+            CB->getFunctionType()->getReturnType()->isPointerTy();
+      }
+    }
----------------
arsenm wrote:

Turn this into a predicate function 

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


More information about the cfe-commits mailing list