[clang] [AMDGPU] Treat printf as builtin for OpenCL (PR #72554)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 16 12:01:53 PST 2023
================
@@ -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;
----------------
b-sumner wrote:
@jhuber6 I do not believe there are any current plans to use GPU libc from HIP or OpenCL. So there will continue to be a division between OpenMP and HIP and OpenCL printf handling.
https://github.com/llvm/llvm-project/pull/72554
More information about the cfe-commits
mailing list