[llvm] [AMDGPU] Skip printf runtime binding if function signature is unexpected (PR #177573)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 23 06:30:49 PST 2026


================
@@ -438,6 +438,13 @@ bool AMDGPUPrintfRuntimeBindingImpl::run(Module &M) {
       M.getModuleFlag("openmp"))
     return false;
 
+  // Verify the signature of the printf function and skip if it isn't correct.
+  const FunctionType *PrintfFunctionTy = PrintfFunction->getFunctionType();
+  if (PrintfFunctionTy->getNumParams() != 1 || !PrintfFunctionTy->isVarArg() ||
+      !PrintfFunctionTy->getReturnType()->isIntegerTy(32) ||
+      !PrintfFunctionTy->getParamType(0)->isPointerTy())
----------------
arsenm wrote:

Probably should verify the address space of the pointer is right too

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


More information about the llvm-commits mailing list