30 lines · cpp
1//===------ PollyModulePass.cpp - Polly module pass ----------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9#include "polly/Pass/PollyModulePass.h"10#include "llvm/IR/Module.h"11 12using namespace llvm;13using namespace polly;14 15PreservedAnalyses PollyModulePass::run(llvm::Module &M,16 llvm::ModuleAnalysisManager &MAM) {17 FunctionAnalysisManager &FAM =18 MAM.getResult<FunctionAnalysisManagerModuleProxy>(M).getManager();19 20 bool ModifiedAnyIR = false;21 for (Function &F : M) {22 bool LocalModifiedIR = runPollyPass(F, FAM, Opts);23 ModifiedAnyIR |= LocalModifiedIR;24 }25 26 // Be conservative about preserved analyses, especially if parallel functions27 // have been outlined.28 return ModifiedAnyIR ? PreservedAnalyses::none() : PreservedAnalyses::all();29}30