[llvm] [DirectX] Get resource information via TargetExtType (PR #119772)

via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 12 13:55:58 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 a480d5172215ce8e49b492e5c0295de1f397954d 9f5564c72ada73feb88bcb82fcdfcc7ca4c4cada --extensions h,cpp -- llvm/include/llvm/Analysis/DXILResource.h llvm/lib/Analysis/DXILResource.cpp llvm/lib/Target/DirectX/DXILOpLowering.cpp llvm/lib/Target/DirectX/DXILPrettyPrinter.cpp llvm/lib/Target/DirectX/DXILTranslateMetadata.cpp llvm/unittests/Analysis/DXILResourceTest.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Analysis/DXILResource.cpp b/llvm/lib/Analysis/DXILResource.cpp
index f96a9468d6..276f315bbf 100644
--- a/llvm/lib/Analysis/DXILResource.cpp
+++ b/llvm/lib/Analysis/DXILResource.cpp
@@ -211,13 +211,9 @@ ResourceInfo::ResourceInfo(uint32_t RecordID, uint32_t Space,
 
 bool ResourceInfo::isUAV() const { return RC == ResourceClass::UAV; }
 
-bool ResourceInfo::isCBuffer() const {
-  return RC == ResourceClass::CBuffer;
-}
+bool ResourceInfo::isCBuffer() const { return RC == ResourceClass::CBuffer; }
 
-bool ResourceInfo::isSampler() const {
-  return RC == ResourceClass::Sampler;
-}
+bool ResourceInfo::isSampler() const { return RC == ResourceClass::Sampler; }
 
 bool ResourceInfo::isStruct() const {
   return Kind == ResourceKind::StructuredBuffer;
@@ -309,8 +305,7 @@ dxil::SamplerType ResourceInfo::getSamplerType() const {
   return cast<SamplerExtType>(HandleTy)->getSamplerType();
 }
 
-ResourceInfo::StructInfo
-ResourceInfo::getStruct(const DataLayout &DL) const {
+ResourceInfo::StructInfo ResourceInfo::getStruct(const DataLayout &DL) const {
   assert(isStruct() && "Not a Struct");
 
   Type *ElTy = cast<RawBufferExtType>(HandleTy)->getResourceType();
@@ -428,8 +423,7 @@ MDTuple *ResourceInfo::getAsMetadata(Module &M) const {
       // All SRVs include sample count in the metadata, but it's only meaningful
       // for multi-sampled textured. Also, UAVs can be multisampled in SM6.7+,
       // but this just isn't reflected in the metadata at all.
-      uint32_t SampleCount =
-          isMultiSample() ? getMultiSampleCount() : 0;
+      uint32_t SampleCount = isMultiSample() ? getMultiSampleCount() : 0;
       MDVals.push_back(getIntMD(SampleCount));
     }
 
@@ -459,8 +453,7 @@ std::pair<uint32_t, uint32_t> ResourceInfo::getAnnotateProps(Module &M) const {
   uint32_t ResourceKind = llvm::to_underlying(getResourceKind());
   uint32_t AlignLog2 = isStruct() ? getStruct(DL).AlignLog2 : 0;
   bool IsUAV = isUAV();
-  ResourceInfo::UAVInfo UAVFlags =
-      IsUAV ? getUAV() : ResourceInfo::UAVInfo{};
+  ResourceInfo::UAVInfo UAVFlags = IsUAV ? getUAV() : ResourceInfo::UAVInfo{};
   bool IsROV = IsUAV && UAVFlags.IsROV;
   bool IsGloballyCoherent = IsUAV && UAVFlags.GloballyCoherent;
   uint8_t SamplerCmpOrHasCounter = 0;

``````````

</details>


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


More information about the llvm-commits mailing list