================ @@ -2458,6 +2458,11 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, &getTarget().getLongDoubleFormat() == &llvm::APFloat::IEEEquad()) BuiltinID = mutateLongDoubleBuiltin(BuiltinID); + // Mutate the printf builtin ID so that we use the same CodeGen path for + // HIP and OpenCL with AMDGPU targets. + if (getTarget().getTriple().isAMDGCN() && BuiltinID == AMDGPU::BIprintf) + BuiltinID = Builtin::BIprintf; ---------------- jhuber6 wrote:
If we do the eager replacement of `printf` that HIP and OpenCL uses currently then it won't be linked in. So users should still be able to link in stuff like `strcmp` or whatever without it interfering. This would require the new driver however, and if they attempted to use something like `fputs` it would segfault because no one initialized the buffer, which isn't a terrible failure mode all things considered. https://github.com/llvm/llvm-project/pull/72554 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits