@@ -323,10 +323,11 @@ class LowerMatrixIntrinsics {
323323 Function &Func;
324324 const DataLayout &DL;
325325 const TargetTransformInfo &TTI;
326- AliasAnalysis *AA;
327- DominatorTree *DT;
328- LoopInfo *LI;
329- OptimizationRemarkEmitter *ORE;
326+ FunctionAnalysisManager *AM;
327+ AliasAnalysis *AA = nullptr ;
328+ DominatorTree *DT = nullptr ;
329+ LoopInfo *LI = nullptr ;
330+ OptimizationRemarkEmitter *ORE = nullptr ;
330331
331332 // / Contains estimates of the number of operations (loads, stores, compute) required to lower a matrix operation.
332333 struct OpInfoTy {
@@ -519,10 +520,8 @@ class LowerMatrixIntrinsics {
519520
520521public:
521522 LowerMatrixIntrinsics (Function &F, TargetTransformInfo &TTI,
522- AliasAnalysis *AA, DominatorTree *DT, LoopInfo *LI,
523- OptimizationRemarkEmitter *ORE)
524- : Func(F), DL(F.getDataLayout()), TTI(TTI), AA(AA), DT(DT),
525- LI(LI), ORE(ORE) {}
523+ FunctionAnalysisManager *AM)
524+ : Func(F), DL(F.getDataLayout()), TTI(TTI), AM(AM) {}
526525
527526 unsigned getNumOps (Type *VT) {
528527 assert (isa<VectorType>(VT) && " Expected vector type" );
@@ -974,6 +973,13 @@ class LowerMatrixIntrinsics {
974973 if (WorkList.empty ())
975974 return false ;
976975
976+ if (AM) {
977+ ORE = &AM->getResult <OptimizationRemarkEmitterAnalysis>(Func);
978+ AA = &AM->getResult <AAManager>(Func);
979+ DT = &AM->getResult <DominatorTreeAnalysis>(Func);
980+ LI = &AM->getResult <LoopAnalysis>(Func);
981+ }
982+
977983 // Propagate shapes until nothing changes any longer.
978984 while (!WorkList.empty ()) {
979985 WorkList = propagateShapeForward (WorkList);
@@ -2618,19 +2624,8 @@ class LowerMatrixIntrinsics {
26182624PreservedAnalyses LowerMatrixIntrinsicsPass::run (Function &F,
26192625 FunctionAnalysisManager &AM) {
26202626 auto &TTI = AM.getResult <TargetIRAnalysis>(F);
2621- OptimizationRemarkEmitter *ORE = nullptr ;
2622- AAResults *AA = nullptr ;
2623- DominatorTree *DT = nullptr ;
2624- LoopInfo *LI = nullptr ;
2625-
2626- if (!Minimal) {
2627- ORE = &AM.getResult <OptimizationRemarkEmitterAnalysis>(F);
2628- AA = &AM.getResult <AAManager>(F);
2629- DT = &AM.getResult <DominatorTreeAnalysis>(F);
2630- LI = &AM.getResult <LoopAnalysis>(F);
2631- }
26322627
2633- LowerMatrixIntrinsics LMT (F, TTI, AA, DT, LI, ORE );
2628+ LowerMatrixIntrinsics LMT (F, TTI, Minimal ? nullptr : &AM );
26342629 if (LMT.Visit ()) {
26352630 PreservedAnalyses PA;
26362631 if (!Minimal) {
0 commit comments