[llvm] 77ddffc - [HLSL] Fix Root signature test error (#127261)

via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 14 15:39:55 PST 2025


Author: joaosaffran
Date: 2025-02-14T15:39:52-08:00
New Revision: 77ddffc946fe6763c6c0ce04aa23315903762c6f

URL: https://github.com/llvm/llvm-project/commit/77ddffc946fe6763c6c0ce04aa23315903762c6f
DIFF: https://github.com/llvm/llvm-project/commit/77ddffc946fe6763c6c0ce04aa23315903762c6f.diff

LOG: [HLSL] Fix Root signature test error (#127261)

Fixing error detected in build bot in file
`RootSignature-MultipleEntryFunctions.ll`

closes: [127260](https://github.com/llvm/llvm-project/issues/127260)

---------

Co-authored-by: joaosaffran <joao.saffran at microsoft.com>

Added: 
    

Modified: 
    llvm/lib/Target/DirectX/DXILRootSignature.cpp
    llvm/test/CodeGen/DirectX/ContainerData/RootSignature-MultipleEntryFunctions.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/DirectX/DXILRootSignature.cpp b/llvm/lib/Target/DirectX/DXILRootSignature.cpp
index 49fc892eade5d..0fecbd698bc5f 100644
--- a/llvm/lib/Target/DirectX/DXILRootSignature.cpp
+++ b/llvm/lib/Target/DirectX/DXILRootSignature.cpp
@@ -186,20 +186,23 @@ PreservedAnalyses RootSignatureAnalysisPrinter::run(Module &M,
   OS << "Root Signature Definitions"
      << "\n";
   uint8_t Space = 0;
-  for (const auto &P : RSDMap) {
-    const auto &[Function, RSD] = P;
-    OS << "Definition for '" << Function->getName() << "':\n";
+  for (const Function &F : M) {
+    auto It = RSDMap.find(&F);
+    if (It == RSDMap.end())
+      continue;
+    const auto &RS = It->second;
+    OS << "Definition for '" << F.getName() << "':\n";
 
     // start root signature header
     Space++;
-    OS << indent(Space) << "Flags: " << format_hex(RSD.Flags, 8) << ":\n";
-    OS << indent(Space) << "Version: " << RSD.Version << ":\n";
-    OS << indent(Space) << "NumParameters: " << RSD.NumParameters << ":\n";
-    OS << indent(Space) << "RootParametersOffset: " << RSD.RootParametersOffset
+    OS << indent(Space) << "Flags: " << format_hex(RS.Flags, 8) << ":\n";
+    OS << indent(Space) << "Version: " << RS.Version << ":\n";
+    OS << indent(Space) << "NumParameters: " << RS.NumParameters << ":\n";
+    OS << indent(Space) << "RootParametersOffset: " << RS.RootParametersOffset
        << ":\n";
-    OS << indent(Space) << "NumStaticSamplers: " << RSD.NumStaticSamplers
+    OS << indent(Space) << "NumStaticSamplers: " << RS.NumStaticSamplers
        << ":\n";
-    OS << indent(Space) << "StaticSamplersOffset: " << RSD.StaticSamplersOffset
+    OS << indent(Space) << "StaticSamplersOffset: " << RS.StaticSamplersOffset
        << ":\n";
     Space--;
     // end root signature header

diff  --git a/llvm/test/CodeGen/DirectX/ContainerData/RootSignature-MultipleEntryFunctions.ll b/llvm/test/CodeGen/DirectX/ContainerData/RootSignature-MultipleEntryFunctions.ll
index 652f8092b7a69..7adb17d0b022f 100644
--- a/llvm/test/CodeGen/DirectX/ContainerData/RootSignature-MultipleEntryFunctions.ll
+++ b/llvm/test/CodeGen/DirectX/ContainerData/RootSignature-MultipleEntryFunctions.ll
@@ -23,7 +23,6 @@ attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }
 !6 = !{ !7 } ; list of root signature elements
 !7 = !{ !"RootFlags", i32 2 } ; 1 = allow_input_assembler_input_layout
 
-
 ; CHECK-LABEL: Definition for 'main':
 ; CHECK-NEXT:   Flags: 0x000001
 ; CHECK-NEXT:   Version: 2


        


More information about the llvm-commits mailing list