1 //===- CoroConditionalWrapper.cpp -----------------------------------------===//
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-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "llvm/Transforms/Coroutines/CoroConditionalWrapper.h"
10 #include "CoroInternal.h"
11 #include "llvm/IR/Module.h"
12 
13 using namespace llvm;
14 
15 CoroConditionalWrapper::CoroConditionalWrapper(ModulePassManager &&PM)
16     : PM(std::move(PM)) {}
17 
18 PreservedAnalyses CoroConditionalWrapper::run(Module &M,
19                                               ModuleAnalysisManager &AM) {
20   if (!coro::declaresAnyIntrinsic(M))
21     return PreservedAnalyses::all();
22 
23   return PM.run(M, AM);
24 }
25