[clang] [llvm] [RFC][AMDGPU] Add vulkan:private/nonprivate MMRAs support (PR #78573)

via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 2 02:01: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 59dd10faf8c3bb9dbcecb60d932284b8762cebf8 4e9fd8a4c6f38bca145493e5e7cfe818a090a965 -- clang/test/CodeGenCXX/builtin-amdgcn-fence-opencl.cpp llvm/include/llvm/IR/MemoryModelRelaxationAnnotations.h llvm/lib/IR/MemoryModelRelaxationAnnotations.cpp llvm/unittests/IR/MemoryModelRelaxationAnnotationsTest.cpp clang/lib/CodeGen/CGBuiltin.cpp clang/lib/CodeGen/CodeGenFunction.h clang/lib/Sema/SemaChecking.cpp llvm/include/llvm/Analysis/VectorUtils.h llvm/include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h llvm/include/llvm/CodeGen/MachineFunction.h llvm/include/llvm/CodeGen/MachineInstr.h llvm/include/llvm/CodeGen/MachineInstrBuilder.h llvm/include/llvm/CodeGen/SelectionDAG.h llvm/include/llvm/IR/IRBuilder.h llvm/lib/Analysis/VectorUtils.cpp llvm/lib/CodeGen/AtomicExpandPass.cpp llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp llvm/lib/CodeGen/MIRPrinter.cpp llvm/lib/CodeGen/MachineFunction.cpp llvm/lib/CodeGen/MachineInstr.cpp llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp llvm/lib/IR/IRBuilder.cpp llvm/lib/IR/Instruction.cpp llvm/lib/IR/Verifier.cpp llvm/lib/Target/AMDGPU/SIMemoryLegalizer.cpp llvm/lib/Transforms/Scalar/MergedLoadStoreMotion.cpp llvm/lib/Transforms/Utils/Local.cpp llvm/lib/Transforms/Utils/SimplifyCFG.cpp llvm/unittests/CodeGen/MachineInstrTest.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/include/llvm/IR/MemoryModelRelaxationAnnotations.h b/llvm/include/llvm/IR/MemoryModelRelaxationAnnotations.h
index d7e3519179..a9ded6034d 100644
--- a/llvm/include/llvm/IR/MemoryModelRelaxationAnnotations.h
+++ b/llvm/include/llvm/IR/MemoryModelRelaxationAnnotations.h
@@ -24,8 +24,7 @@
 
 namespace llvm {
 
-template<typename T>
-class ArrayRef;
+template <typename T> class ArrayRef;
 
 class MDNode;
 class MDTuple;
diff --git a/llvm/lib/IR/MemoryModelRelaxationAnnotations.cpp b/llvm/lib/IR/MemoryModelRelaxationAnnotations.cpp
index a9e14d81a0..19f438d890 100644
--- a/llvm/lib/IR/MemoryModelRelaxationAnnotations.cpp
+++ b/llvm/lib/IR/MemoryModelRelaxationAnnotations.cpp
@@ -62,15 +62,16 @@ MDTuple *MMRAMetadata::getTagMD(LLVMContext &Ctx, StringRef Prefix,
                       {MDString::get(Ctx, Prefix), MDString::get(Ctx, Suffix)});
 }
 
-MDTuple *MMRAMetadata::getMD(LLVMContext &Ctx, ArrayRef<MMRAMetadata::TagT> Tags) {
+MDTuple *MMRAMetadata::getMD(LLVMContext &Ctx,
+                             ArrayRef<MMRAMetadata::TagT> Tags) {
   if (Tags.empty())
     return nullptr;
 
   if (Tags.size() == 1)
     return getTagMD(Ctx, Tags.front());
 
-  SmallVector<Metadata*> MMRAs;
-  for(const auto &Tag: Tags)
+  SmallVector<Metadata *> MMRAs;
+  for (const auto &Tag : Tags)
     MMRAs.push_back(getTagMD(Ctx, Tag));
   return MDTuple::get(Ctx, MMRAs);
 }
diff --git a/llvm/unittests/IR/MemoryModelRelaxationAnnotationsTest.cpp b/llvm/unittests/IR/MemoryModelRelaxationAnnotationsTest.cpp
index 13e52909ae..623236436e 100644
--- a/llvm/unittests/IR/MemoryModelRelaxationAnnotationsTest.cpp
+++ b/llvm/unittests/IR/MemoryModelRelaxationAnnotationsTest.cpp
@@ -57,18 +57,18 @@ TEST(MMRATest, GetMD) {
 
   EXPECT_EQ(MMRAMetadata::getMD(Ctx, {}), nullptr);
 
-  MDTuple* SingleMD = MMRAMetadata::getMD(Ctx, {{"foo", "bar"}});
+  MDTuple *SingleMD = MMRAMetadata::getMD(Ctx, {{"foo", "bar"}});
   EXPECT_EQ(SingleMD->getNumOperands(), 2);
   EXPECT_EQ(cast<MDString>(SingleMD->getOperand(0))->getString(), "foo");
   EXPECT_EQ(cast<MDString>(SingleMD->getOperand(1))->getString(), "bar");
 
-  MDTuple* MultiMD = MMRAMetadata::getMD(Ctx, {{"foo", "bar"}, {"bux", "qux"}});
+  MDTuple *MultiMD = MMRAMetadata::getMD(Ctx, {{"foo", "bar"}, {"bux", "qux"}});
   EXPECT_EQ(MultiMD->getNumOperands(), 2);
 
-  MDTuple* FooBar = cast<MDTuple>(MultiMD->getOperand(0));
+  MDTuple *FooBar = cast<MDTuple>(MultiMD->getOperand(0));
   EXPECT_EQ(cast<MDString>(FooBar->getOperand(0))->getString(), "foo");
   EXPECT_EQ(cast<MDString>(FooBar->getOperand(1))->getString(), "bar");
-  MDTuple* BuxQux = cast<MDTuple>(MultiMD->getOperand(1));
+  MDTuple *BuxQux = cast<MDTuple>(MultiMD->getOperand(1));
   EXPECT_EQ(cast<MDString>(BuxQux->getOperand(0))->getString(), "bux");
   EXPECT_EQ(cast<MDString>(BuxQux->getOperand(1))->getString(), "qux");
 }

``````````

</details>


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


More information about the cfe-commits mailing list