Prechádzať zdrojové kódy

Add reducibility analysis to the list of passes and paramless ctor. (#133)

Add reducibility analysis to the list of passes and paramless ctor.

This restores the property of having all passes initialized at DLL load time, keeps the reported list of passes stable, and fixes an assertion when the DLL is loaded on a thread but the first compile invocation occurs in a different thread.
Marcelo Lopez Ruiz 8 rokov pred
rodič
commit
d7f75ac8f0

+ 1 - 0
lib/HLSL/DxcOptimizer.cpp

@@ -111,6 +111,7 @@ HRESULT SetupRegistryPassForHLSL() {
     initializePromotePassPass(Registry);
     initializePruneEHPass(Registry);
     initializeReassociatePass(Registry);
+    initializeReducibilityAnalysisPass(Registry);
     initializeRegToMemHlslPass(Registry);
     initializeRewriteSymbolsPass(Registry);
     initializeSCCPPass(Registry);

+ 6 - 4
lib/HLSL/ReducibilityAnalysis.cpp

@@ -48,10 +48,12 @@ class ReducibilityAnalysis : public FunctionPass {
 public:
   static char ID;
 
-  explicit ReducibilityAnalysis(IrreducibilityAction Action = IrreducibilityAction::ThrowException) 
-    : FunctionPass(ID), m_Action(Action), m_bReducible(false) {
-    initializeReducibilityAnalysisPass(*PassRegistry::getPassRegistry());
-  }
+  ReducibilityAnalysis()
+      : FunctionPass(ID), m_Action(IrreducibilityAction::ThrowException),
+        m_bReducible(false) {}
+
+  explicit ReducibilityAnalysis(IrreducibilityAction Action)
+      : FunctionPass(ID), m_Action(Action), m_bReducible(false) {}
 
   virtual bool runOnFunction(Function &F);
 

+ 1 - 0
utils/hct/hctdb.py

@@ -1285,6 +1285,7 @@ class db_dxil(object):
         add_pass('constmerge', 'ConstantMerge', 'Merge Duplicate Global Constants', [])
         add_pass('lowerbitsets', 'LowerBitSets', 'Lower bitset metadata', [
             {'n':'lowerbitsets-avoid-reuse', 'i':'AvoidReuse', 't':'bool', 'd':'Try to avoid reuse of byte array addresses using aliases'}])
+        add_pass('red', 'ReducibilityAnalysis', 'Reducibility Analysis', [])
         # TODO: turn STATISTICS macros into ETW events
         # assert no duplicate names
         self.pass_idx_args = set()