[llvm] [DXIL][Analysis] Collect Function properties in Metadata Analysis (PR #105728)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 27 15:10:10 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 4b35624ce0ac5b487d39880e75b5d85f4d49eec0 92ffbbb63c1d5599cf7b696c270c49654270ed09 --extensions cpp,h -- llvm/include/llvm/Analysis/DXILMetadataAnalysis.h llvm/lib/Analysis/DXILMetadataAnalysis.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/Analysis/DXILMetadataAnalysis.cpp b/llvm/lib/Analysis/DXILMetadataAnalysis.cpp
index 9d8fa2fa48..7577097f75 100644
--- a/llvm/lib/Analysis/DXILMetadataAnalysis.cpp
+++ b/llvm/lib/Analysis/DXILMetadataAnalysis.cpp
@@ -39,41 +39,41 @@ static ModuleMetadataInfo collectMetadataInfo(Module &M) {
VersionTuple(MajorMD->getZExtValue(), MinorMD->getZExtValue());
}
- // For all HLSL Shader functions
- for (auto &F : M.functions()) {
- if (!F.hasFnAttribute("hlsl.shader"))
- continue;
-
- FunctionProperties EFP{};
- // Get "hlsl.shader" attribute
- Attribute EntryAttr = F.getFnAttribute("hlsl.shader");
- StringRef EntryProfile = EntryAttr.getValueAsString();
- Triple T("", "", "", EntryProfile);
- EFP.ShaderStage = T.getEnvironment();
- // Get numthreads attribute value, if one exists
- StringRef NumThreadsStr =
- F.getFnAttribute("hlsl.numthreads").getValueAsString();
- if (!NumThreadsStr.empty()) {
- SmallVector<StringRef> NumThreadsVec;
- NumThreadsStr.split(NumThreadsVec, ',');
- if (NumThreadsVec.size() != 3) {
- report_fatal_error(Twine(F.getName()) +
- ": Invalid numthreads specified",
- /* gen_crash_diag */ false);
- }
- auto Zip =
- llvm::zip(NumThreadsVec, MutableArrayRef<unsigned>(EFP.NumThreads));
- for (auto It : Zip) {
- StringRef Str = std::get<0>(It);
- APInt V;
- assert(!Str.getAsInteger(10, V) &&
- "Failed to parse numthreads components as integer values");
- unsigned &Num = std::get<1>(It);
- Num = V.getLimitedValue();
- }
+ // For all HLSL Shader functions
+ for (auto &F : M.functions()) {
+ if (!F.hasFnAttribute("hlsl.shader"))
+ continue;
+
+ FunctionProperties EFP{};
+ // Get "hlsl.shader" attribute
+ Attribute EntryAttr = F.getFnAttribute("hlsl.shader");
+ StringRef EntryProfile = EntryAttr.getValueAsString();
+ Triple T("", "", "", EntryProfile);
+ EFP.ShaderStage = T.getEnvironment();
+ // Get numthreads attribute value, if one exists
+ StringRef NumThreadsStr =
+ F.getFnAttribute("hlsl.numthreads").getValueAsString();
+ if (!NumThreadsStr.empty()) {
+ SmallVector<StringRef> NumThreadsVec;
+ NumThreadsStr.split(NumThreadsVec, ',');
+ if (NumThreadsVec.size() != 3) {
+ report_fatal_error(Twine(F.getName()) +
+ ": Invalid numthreads specified",
+ /* gen_crash_diag */ false);
+ }
+ auto Zip =
+ llvm::zip(NumThreadsVec, MutableArrayRef<unsigned>(EFP.NumThreads));
+ for (auto It : Zip) {
+ StringRef Str = std::get<0>(It);
+ APInt V;
+ assert(!Str.getAsInteger(10, V) &&
+ "Failed to parse numthreads components as integer values");
+ unsigned &Num = std::get<1>(It);
+ Num = V.getLimitedValue();
}
- MMDAI.FunctionPropertyMap.emplace(std::make_pair(std::addressof(F), EFP));
}
+ MMDAI.FunctionPropertyMap.emplace(std::make_pair(std::addressof(F), EFP));
+ }
return MMDAI;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/105728
More information about the llvm-commits
mailing list