[llvm-branch-commits] [llvm] [WIP] Handle guard insertion in callbacks to OpenMP runtime functions. (PR #164655)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Oct 22 09:17:10 PDT 2025


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 origin/main HEAD --extensions cpp -- llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp llvm/lib/Transforms/IPO/OpenMPOpt.cpp llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

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

``````````diff
diff --git a/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp b/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
index aca2153f8..376cee8d7 100644
--- a/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
+++ b/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
@@ -7964,38 +7964,39 @@ TEST_F(OpenMPIRBuilderTest, callBackFunctions) {
 
   // Test multiple runtime functions that should have callback metadata
   std::vector<RuntimeFunction> CallbackFunctions = {
-    OMPRTL___kmpc_distribute_static_loop_4,
-    OMPRTL___kmpc_distribute_static_loop_4u,
-    OMPRTL___kmpc_distribute_static_loop_8,
-    OMPRTL___kmpc_distribute_static_loop_8u,
-    OMPRTL___kmpc_distribute_for_static_loop_4,
-    OMPRTL___kmpc_distribute_for_static_loop_4u,
-    OMPRTL___kmpc_distribute_for_static_loop_8,
-    OMPRTL___kmpc_distribute_for_static_loop_8u,
-    OMPRTL___kmpc_for_static_loop_4,
-    OMPRTL___kmpc_for_static_loop_4u,
-    OMPRTL___kmpc_for_static_loop_8,
-    OMPRTL___kmpc_for_static_loop_8u
-  };
+      OMPRTL___kmpc_distribute_static_loop_4,
+      OMPRTL___kmpc_distribute_static_loop_4u,
+      OMPRTL___kmpc_distribute_static_loop_8,
+      OMPRTL___kmpc_distribute_static_loop_8u,
+      OMPRTL___kmpc_distribute_for_static_loop_4,
+      OMPRTL___kmpc_distribute_for_static_loop_4u,
+      OMPRTL___kmpc_distribute_for_static_loop_8,
+      OMPRTL___kmpc_distribute_for_static_loop_8u,
+      OMPRTL___kmpc_for_static_loop_4,
+      OMPRTL___kmpc_for_static_loop_4u,
+      OMPRTL___kmpc_for_static_loop_8,
+      OMPRTL___kmpc_for_static_loop_8u};
 
   for (RuntimeFunction RF : CallbackFunctions) {
     Function *Fn = OMPBuilder.getOrCreateRuntimeFunctionPtr(RF);
     ASSERT_NE(Fn, nullptr) << "Function should exist for runtime function";
-    
+
     MDNode *CallbackMD = Fn->getMetadata(LLVMContext::MD_callback);
     EXPECT_NE(CallbackMD, nullptr) << "Function should have callback metadata";
-    
+
     if (CallbackMD) {
       // Should have at least one callback
       EXPECT_GE(CallbackMD->getNumOperands(), 1U);
-      
+
       // Test first callback entry
       MDNode *FirstCallback = cast<MDNode>(CallbackMD->getOperand(0));
       EXPECT_EQ(FirstCallback->getNumOperands(), 4U);
-      
+
       // Callee index should be valid
-      auto *CalleeIdxCM = cast<ConstantAsMetadata>(FirstCallback->getOperand(0));
-      uint64_t CalleeIdx = cast<ConstantInt>(CalleeIdxCM->getValue())->getZExtValue();
+      auto *CalleeIdxCM =
+          cast<ConstantAsMetadata>(FirstCallback->getOperand(0));
+      uint64_t CalleeIdx =
+          cast<ConstantInt>(CalleeIdxCM->getValue())->getZExtValue();
       EXPECT_EQ(CalleeIdx, 1u);
 
       // Verify payload arguments re (-1, 2)
@@ -8014,5 +8015,4 @@ TEST_F(OpenMPIRBuilderTest, callBackFunctions) {
   }
 }
 
-
 } // namespace

``````````

</details>


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


More information about the llvm-branch-commits mailing list