[llvm] [Metadata][profcheck] Handle identical MDNodes in getMergedProfMetadata (PR #175701)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 12 20:08:28 PST 2026


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/IR/Metadata.cpp llvm/unittests/IR/MetadataTest.cpp --diff_from_common_commit
``````````

: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/IR/MetadataTest.cpp b/llvm/unittests/IR/MetadataTest.cpp
index 24e8b47b7..5b4935f8b 100644
--- a/llvm/unittests/IR/MetadataTest.cpp
+++ b/llvm/unittests/IR/MetadataTest.cpp
@@ -5488,7 +5488,8 @@ TEST_F(MDNodeTest, MergedProfMetadata) {
 }
 
 TEST_F(MDNodeTest, MergedProfMetadata_CallInst) {
-  // Check that identical profile metadata on CallInsts is SUMMED, not preserved.
+  // Check that identical profile metadata on CallInsts is SUMMED, not
+  // preserved.
   Metadata *Ops[] = {
       MDString::get(Context, "branch_weights"),
       ConstantAsMetadata::get(ConstantInt::get(Context, APInt(32, 10)))};
@@ -5496,8 +5497,10 @@ TEST_F(MDNodeTest, MergedProfMetadata_CallInst) {
 
   // Create two CallInsts.
   FunctionType *FTy = FunctionType::get(Type::getVoidTy(Context), false);
-  std::unique_ptr<CallInst> CI1(CallInst::Create(FTy, getFunction("f"), ArrayRef<Value *>()));
-  std::unique_ptr<CallInst> CI2(CallInst::Create(FTy, getFunction("f"), ArrayRef<Value *>()));
+  std::unique_ptr<CallInst> CI1(
+      CallInst::Create(FTy, getFunction("f"), ArrayRef<Value *>()));
+  std::unique_ptr<CallInst> CI2(
+      CallInst::Create(FTy, getFunction("f"), ArrayRef<Value *>()));
 
   CI1->setMetadata(LLVMContext::MD_prof, Prof);
   CI2->setMetadata(LLVMContext::MD_prof, Prof);

``````````

</details>


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


More information about the llvm-commits mailing list