================
@@ -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;
----------------
vikramRH wrote:
@jhuber6 , I had your implementation in mind when I wrote this, The printf wont
be expanded by clang with "-fno-builtin" and users would still have an option
to use a lib variant if need be. This also makes this more elegant as we would
not have to hack the "fno-builtin" handling into the implementation, this is
part of clang builtin handling.
https://github.com/llvm/llvm-project/pull/72554
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits