[clang] [llvm] Enable OpenCL hostcall printf (WIP) (PR #72556)

via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 16 10:58:32 PST 2023


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff cb4627d15027e1ed0051f5e5af447602f0f60971 f9329597564d4e3390f6d0d3a08e4a6f66b52de4 -- clang/lib/AST/Decl.cpp clang/lib/Basic/Targets/AMDGPU.cpp clang/lib/CodeGen/CGBuiltin.cpp clang/lib/CodeGen/CGGPUBuiltin.cpp clang/lib/Driver/ToolChains/Clang.cpp llvm/lib/Transforms/Utils/AMDGPUEmitPrintf.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 8d51df24c7..d21bbf9b5f 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -2458,10 +2458,10 @@ 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;
+  // 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;
 
   // If the builtin has been declared explicitly with an assembler label,
   // disable the specialized emitting below. Ideally we should communicate the
@@ -5623,7 +5623,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
       if (getTarget().getTriple().isNVPTX())
         return EmitNVPTXDevicePrintfCallExpr(E);
       if (getTarget().getTriple().isAMDGCN() &&
-         (getLangOpts().HIP || getLangOpts().OpenCL))
+          (getLangOpts().HIP || getLangOpts().OpenCL))
         return EmitAMDGPUDevicePrintfCallExpr(E);
     }
 
diff --git a/clang/lib/CodeGen/CGGPUBuiltin.cpp b/clang/lib/CodeGen/CGGPUBuiltin.cpp
index 81e23bc325..5a903fb1da 100644
--- a/clang/lib/CodeGen/CGGPUBuiltin.cpp
+++ b/clang/lib/CodeGen/CGGPUBuiltin.cpp
@@ -217,8 +217,7 @@ RValue CodeGenFunction::EmitAMDGPUDevicePrintfCallExpr(const CallExpr *E) {
   }
 
   auto PFK = CGM.getTarget().getTargetOpts().AMDGPUPrintfKindVal;
-  bool isBuffered =
-       (PFK == clang::TargetOptions::AMDGPUPrintfKind::Buffered);
+  bool isBuffered = (PFK == clang::TargetOptions::AMDGPUPrintfKind::Buffered);
   auto Printf = llvm::emitAMDGPUPrintfCall(IRB, Args, isBuffered);
   Builder.SetInsertPoint(IRB.GetInsertBlock(), IRB.GetInsertPoint());
   return RValue::get(Printf);

``````````

</details>


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


More information about the cfe-commits mailing list