diff options
Diffstat (limited to 'contrib/llvm/lib/Analysis/AssumptionCache.cpp')
-rw-r--r-- | contrib/llvm/lib/Analysis/AssumptionCache.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/contrib/llvm/lib/Analysis/AssumptionCache.cpp b/contrib/llvm/lib/Analysis/AssumptionCache.cpp index da5ba18..f468a43 100644 --- a/contrib/llvm/lib/Analysis/AssumptionCache.cpp +++ b/contrib/llvm/lib/Analysis/AssumptionCache.cpp @@ -18,6 +18,7 @@ #include "llvm/IR/Function.h" #include "llvm/IR/Instructions.h" #include "llvm/IR/IntrinsicInst.h" +#include "llvm/IR/PassManager.h" #include "llvm/IR/PatternMatch.h" #include "llvm/Support/Debug.h" using namespace llvm; @@ -73,6 +74,20 @@ void AssumptionCache::registerAssumption(CallInst *CI) { #endif } +char AssumptionAnalysis::PassID; + +PreservedAnalyses AssumptionPrinterPass::run(Function &F, + AnalysisManager<Function> *AM) { + AssumptionCache &AC = AM->getResult<AssumptionAnalysis>(F); + + OS << "Cached assumptions for function: " << F.getName() << "\n"; + for (auto &VH : AC.assumptions()) + if (VH) + OS << " " << *cast<CallInst>(VH)->getArgOperand(0) << "\n"; + + return PreservedAnalyses::all(); +} + void AssumptionCacheTracker::FunctionCallbackVH::deleted() { auto I = ACT->AssumptionCaches.find_as(cast<Function>(getValPtr())); if (I != ACT->AssumptionCaches.end()) |