[clang] [HLSL][SPIRV] Add convergence tokens to entry point wrapper (PR #112757)

via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 17 11:16:35 PDT 2024


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 ab208de34efbde4fea03732eaa353a701e72f626 24e84865fe8cd9684c6e5b2763970ba278038039 --extensions cpp,h -- clang/lib/CodeGen/CGHLSLRuntime.cpp clang/lib/CodeGen/CGHLSLRuntime.h
``````````

</details>

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

``````````diff
diff --git a/clang/lib/CodeGen/CGHLSLRuntime.cpp b/clang/lib/CodeGen/CGHLSLRuntime.cpp
index d006f5d8f3..2250e151ae 100644
--- a/clang/lib/CodeGen/CGHLSLRuntime.cpp
+++ b/clang/lib/CodeGen/CGHLSLRuntime.cpp
@@ -403,9 +403,8 @@ void CGHLSLRuntime::emitEntryFunction(const FunctionDecl *FD,
   SmallVector<OperandBundleDef, 1> OB;
   if (CGM.shouldEmitConvergenceTokens()) {
     assert(EntryFn->isConvergent());
-    llvm::Value *
-        I = B.CreateIntrinsic(llvm::Intrinsic::experimental_convergence_entry, {},
-                              {});
+    llvm::Value *I = B.CreateIntrinsic(
+        llvm::Intrinsic::experimental_convergence_entry, {}, {});
     llvm::Value *bundleArgs[] = {I};
     OB.emplace_back("convergencectrl", bundleArgs);
   }
@@ -480,8 +479,8 @@ void CGHLSLRuntime::generateGlobalCtorDtorCalls() {
   for (auto &F : M.functions()) {
     if (!F.hasFnAttribute("hlsl.shader"))
       continue;
-    auto* Token = getConvergenceToken(F.getEntryBlock());
-    Instruction* IP = Token ? Token : &*F.getEntryBlock().begin();
+    auto *Token = getConvergenceToken(F.getEntryBlock());
+    Instruction *IP = Token ? Token : &*F.getEntryBlock().begin();
     IRBuilder<> B(IP);
     std::vector<OperandBundleDef> OB;
     if (Token) {
@@ -513,7 +512,7 @@ llvm::Instruction *CGHLSLRuntime::getConvergenceToken(BasicBlock &BB) {
     return nullptr;
 
   auto E = BB.end();
-  for(auto I = BB.begin(); I != E; ++I) {
+  for (auto I = BB.begin(); I != E; ++I) {
     auto *II = dyn_cast<llvm::IntrinsicInst>(&*I);
     if (II && llvm::isConvergenceControlIntrinsic(II->getIntrinsicID())) {
       return II;

``````````

</details>


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


More information about the cfe-commits mailing list