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

Zahira Ammarguellat via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 12 07:12:23 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;
----------------
zahiraam wrote:

> Should probably be looking at the source signature, not the IR?

I think I need to look at the IR to see how the complex type has been processed. If I look at the source argument, it will be a complex type.

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


More information about the cfe-commits mailing list