Переглянути джерело

Faster printing when validation fails with really big shaders (#2737)

Adam Yang 5 роки тому
батько
коміт
52a54200c5
1 змінених файлів з 5 додано та 2 видалено
  1. 5 2
      lib/HLSL/DxilValidation.cpp

+ 5 - 2
lib/HLSL/DxilValidation.cpp

@@ -40,6 +40,7 @@
 #include "llvm/IR/DiagnosticInfo.h"
 #include "llvm/IR/DiagnosticPrinter.h"
 #include "llvm/IR/Verifier.h"
+#include "llvm/IR/ModuleSlotTracker.h"
 #include "llvm/ADT/BitVector.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Support/MemoryBuffer.h"
@@ -416,6 +417,7 @@ struct ValidationContext {
   const unsigned kDxilNonUniformMDKind;
   const unsigned kLLVMLoopMDKind;
   unsigned m_DxilMajor, m_DxilMinor;
+  ModuleSlotTracker slotTracker;
 
   ValidationContext(Module &llvmModule, Module *DebugModule,
                     DxilModule &dxilModule,
@@ -429,7 +431,8 @@ struct ValidationContext {
             DxilMDHelper::kDxilPreciseAttributeMDName)),
         kDxilNonUniformMDKind(llvmModule.getContext().getMDKindID(
             DxilMDHelper::kDxilNonUniformAttributeMDName)),
-        kLLVMLoopMDKind(llvmModule.getContext().getMDKindID("llvm.loop")) {
+        kLLVMLoopMDKind(llvmModule.getContext().getMDKindID("llvm.loop")),
+        slotTracker(&llvmModule, true) {
     DxilMod.GetDxilVersion(m_DxilMajor, m_DxilMinor);
 
     for (Function &F : llvmModule.functions()) {
@@ -774,7 +777,7 @@ struct ValidationContext {
     // Printthe instruction
     std::string InstrStr;
     raw_string_ostream InstrStream(InstrStr);
-    I->print(InstrStream);
+    I->print(InstrStream, slotTracker);
     InstrStream.flush();
     StringRef InstrStrRef = InstrStr;
     InstrStrRef = InstrStrRef.ltrim(); // Ignore indentation