================
@@ -212,20 +230,24 @@ PreservedAnalyses ShaderFlagsAnalysisPrinter::run(Module 
&M,
 bool ShaderFlagsAnalysisWrapper::runOnModule(Module &M) {
   DXILResourceTypeMap &DRTM =
       getAnalysis<DXILResourceTypeWrapperPass>().getResourceTypeMap();
+  const ModuleMetadataInfo MMDI =
+      getAnalysis<DXILMetadataAnalysisWrapperPass>().getModuleMetadata();
 
-  MSFI.initialize(M, DRTM);
+  MSFI.initialize(M, DRTM, MMDI);
   return false;
 }
 
 void ShaderFlagsAnalysisWrapper::getAnalysisUsage(AnalysisUsage &AU) const {
   AU.setPreservesAll();
   AU.addRequiredTransitive<DXILResourceTypeWrapperPass>();
+  AU.addRequired<DXILMetadataAnalysisWrapperPass>();
----------------
bharadwajy wrote:

> This change causes DXIL Module Metadata analysis pass to run before DXIL 
> Shader Flag Analysis because it is now needed 
> `MMDI.EntryPropertyVec[0].Entry->hasFnAttribute( 
> llvm::Attribute::OptimizeNone);` to initialize ModuleShaderFlags.
> 
> I think before we never intended to fetch fn attributes since you were using 
> `dx.disable_optimizations`. 

Yes, that was the proposed mechanism in PR #126813. This PR supersedes that 
following the feedback there.

> Does that make optnone a one off here or are there other attributes that 
> could use this pattern?

The list of entry function information collected by Metadata Analysis pass is 
leveraged in this pass to look at `optnone` of each of the entry functions. 
Similarly it can be leveraged by other passes that require access to entry 
function information - for example, a pass that would want to query for entry 
function declaration with`HLSLWaveSizeAttr`.

Entry functions can be collected during the call graph traversal in this pass 
to query for `optnone` attribute. I just chose to leverage the same info that 
would be built in Metadata Analysis pass.

https://github.com/llvm/llvm-project/pull/126813
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to