[llvm] 18f0da2 - [HLSL][DirectX] Avoid some unnecessary casting. NFC
Justin Bogner via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 8 15:40:35 PST 2023
Author: Justin Bogner
Date: 2023-12-08T15:38:09-08:00
New Revision: 18f0da26b292341f84f91d4ce731b046315cd0a1
URL: https://github.com/llvm/llvm-project/commit/18f0da26b292341f84f91d4ce731b046315cd0a1
DIFF: https://github.com/llvm/llvm-project/commit/18f0da26b292341f84f91d4ce731b046315cd0a1.diff
LOG: [HLSL][DirectX] Avoid some unnecessary casting. NFC
Added:
Modified:
llvm/include/llvm/Frontend/HLSL/HLSLResource.h
llvm/lib/Frontend/HLSL/HLSLResource.cpp
llvm/lib/Target/DirectX/DXILResource.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Frontend/HLSL/HLSLResource.h b/llvm/include/llvm/Frontend/HLSL/HLSLResource.h
index ba08ee519351f7..997ddccd687a7c 100644
--- a/llvm/include/llvm/Frontend/HLSL/HLSLResource.h
+++ b/llvm/include/llvm/Frontend/HLSL/HLSLResource.h
@@ -67,7 +67,7 @@ class FrontendResource {
GlobalVariable *getGlobalVariable();
StringRef getSourceType();
- uint32_t getResourceKind();
+ ResourceKind getResourceKind();
uint32_t getResourceIndex();
uint32_t getSpace();
MDNode *getMetadata() { return Entry; }
diff --git a/llvm/lib/Frontend/HLSL/HLSLResource.cpp b/llvm/lib/Frontend/HLSL/HLSLResource.cpp
index 59f730d8a495dc..a3a7d0b8696cf3 100644
--- a/llvm/lib/Frontend/HLSL/HLSLResource.cpp
+++ b/llvm/lib/Frontend/HLSL/HLSLResource.cpp
@@ -27,10 +27,11 @@ StringRef FrontendResource::getSourceType() {
return cast<MDString>(Entry->getOperand(1))->getString();
}
-uint32_t FrontendResource::FrontendResource::getResourceKind() {
- return cast<ConstantInt>(
- cast<ConstantAsMetadata>(Entry->getOperand(2))->getValue())
- ->getLimitedValue();
+ResourceKind FrontendResource::getResourceKind() {
+ return static_cast<ResourceKind>(
+ cast<ConstantInt>(
+ cast<ConstantAsMetadata>(Entry->getOperand(2))->getValue())
+ ->getLimitedValue());
}
uint32_t FrontendResource::getResourceIndex() {
return cast<ConstantInt>(
diff --git a/llvm/lib/Target/DirectX/DXILResource.cpp b/llvm/lib/Target/DirectX/DXILResource.cpp
index 0390a3f0a558d8..041b8fafcd6ad9 100644
--- a/llvm/lib/Target/DirectX/DXILResource.cpp
+++ b/llvm/lib/Target/DirectX/DXILResource.cpp
@@ -233,9 +233,8 @@ void ResourceBase::print(raw_ostream &OS, StringRef IDPrefix,
}
UAVResource::UAVResource(uint32_t I, FrontendResource R)
- : ResourceBase(I, R),
- Shape(static_cast<ResourceBase::Kinds>(R.getResourceKind())),
- GloballyCoherent(false), HasCounter(false), IsROV(false), ExtProps() {
+ : ResourceBase(I, R), Shape(R.getResourceKind()), GloballyCoherent(false),
+ HasCounter(false), IsROV(false), ExtProps() {
parseSourceType(R.getSourceType());
}
More information about the llvm-commits
mailing list