[clang] [AMDGPU] Introduce 'amdgpu_num_workgroups_{xyz}' builtin (PR #83927)

via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 4 15:34:25 PST 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 32e2294b8abba6b70356aa37b65acf155506d457 b7090a51b8322cc1c05f5a05894fef5a56dcbcf7 -- clang/lib/CodeGen/CGBuiltin.cpp clang/test/CodeGen/amdgpu-abi-version.c
``````````

</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 fac1921d0f..f2f1fc1abb 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -17819,20 +17819,20 @@ Value *EmitAMDGPUImplicitArgPtr(CodeGenFunction &CGF) {
 /// Note: "__oclc_ABI_version" is supposed to be emitted and intialized by
 ///       clang during compilation of user code.
 Value *getAMDGPUABIVersion(CodeGenFunction &CGF) {
-    StringRef Name = "__oclc_ABI_version";
-    auto *ABIVersionC = CGF.CGM.getModule().getNamedGlobal(Name);
-    if (!ABIVersionC)
-      ABIVersionC = new llvm::GlobalVariable(
-          CGF.CGM.getModule(), CGF.Int32Ty, false,
-          llvm::GlobalValue::ExternalLinkage, nullptr, Name, nullptr,
-          llvm::GlobalVariable::NotThreadLocal,
-          CGF.CGM.getContext().getTargetAddressSpace(LangAS::opencl_constant));
-
-    // This load will be eliminated by the IPSCCP because it is constant
-    // weak_odr without externally_initialized. Either changing it to weak or
-    // adding externally_initialized will keep the load.
-    return CGF.Builder.CreateAlignedLoad(CGF.Int32Ty, ABIVersionC,
-                                         CGF.CGM.getIntAlign());
+  StringRef Name = "__oclc_ABI_version";
+  auto *ABIVersionC = CGF.CGM.getModule().getNamedGlobal(Name);
+  if (!ABIVersionC)
+    ABIVersionC = new llvm::GlobalVariable(
+        CGF.CGM.getModule(), CGF.Int32Ty, false,
+        llvm::GlobalValue::ExternalLinkage, nullptr, Name, nullptr,
+        llvm::GlobalVariable::NotThreadLocal,
+        CGF.CGM.getContext().getTargetAddressSpace(LangAS::opencl_constant));
+
+  // This load will be eliminated by the IPSCCP because it is constant
+  // weak_odr without externally_initialized. Either changing it to weak or
+  // adding externally_initialized will keep the load.
+  return CGF.Builder.CreateAlignedLoad(CGF.Int32Ty, ABIVersionC,
+                                       CGF.CGM.getIntAlign());
 }
 
 /// Emit code based on Code Object ABI version.

``````````

</details>


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


More information about the cfe-commits mailing list