summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/CGSCCPassManager.cpp
diff options
context:
space:
mode:
authorEugene Zelenko <eugene.zelenko@gmail.com>2017-08-31 21:56:16 +0000
committerEugene Zelenko <eugene.zelenko@gmail.com>2017-08-31 21:56:16 +0000
commitfa6434bebb74cb8db67a3835e18ebd3f1f176862 (patch)
tree97aab4d02aafcfea733775bab8fcb69fce3faf42 /llvm/lib/Analysis/CGSCCPassManager.cpp
parent9da05740d34ef6cb0cb695d9df0b0a36d7f7951e (diff)
downloadbcm5719-llvm-fa6434bebb74cb8db67a3835e18ebd3f1f176862.tar.gz
bcm5719-llvm-fa6434bebb74cb8db67a3835e18ebd3f1f176862.zip
[Analysis] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes. Also affected in files (NFC).
llvm-svn: 312289
Diffstat (limited to 'llvm/lib/Analysis/CGSCCPassManager.cpp')
-rw-r--r--llvm/lib/Analysis/CGSCCPassManager.cpp47
1 files changed, 31 insertions, 16 deletions
diff --git a/llvm/lib/Analysis/CGSCCPassManager.cpp b/llvm/lib/Analysis/CGSCCPassManager.cpp
index 46d384922af..9e6384437fb 100644
--- a/llvm/lib/Analysis/CGSCCPassManager.cpp
+++ b/llvm/lib/Analysis/CGSCCPassManager.cpp
@@ -8,8 +8,25 @@
//===----------------------------------------------------------------------===//
#include "llvm/Analysis/CGSCCPassManager.h"
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/Optional.h"
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/SetVector.h"
+#include "llvm/ADT/SmallPtrSet.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/iterator_range.h"
+#include "llvm/Analysis/LazyCallGraph.h"
#include "llvm/IR/CallSite.h"
+#include "llvm/IR/Constant.h"
#include "llvm/IR/InstIterator.h"
+#include "llvm/IR/Instruction.h"
+#include "llvm/IR/PassManager.h"
+#include "llvm/Support/Casting.h"
+#include "llvm/Support/Debug.h"
+#include "llvm/Support/raw_ostream.h"
+#include <algorithm>
+#include <cassert>
+#include <iterator>
#define DEBUG_TYPE "cgscc"
@@ -262,7 +279,7 @@ bool FunctionAnalysisManagerCGSCCProxy::Result::invalidate(
return false;
}
-} // End llvm namespace
+} // end namespace llvm
/// When a new SCC is created for the graph and there might be function
/// analysis results cached for the functions now in that SCC two forms of
@@ -309,7 +326,6 @@ static void updateNewSCCFunctionAnalyses(LazyCallGraph::SCC &C,
}
}
-namespace {
/// Helper function to update both the \c CGSCCAnalysisManager \p AM and the \c
/// CGSCCPassManager's \c CGSCCUpdateResult \p UR based on a range of newly
/// added SCCs.
@@ -321,11 +337,11 @@ namespace {
/// This function returns the SCC containing \p N. This will be either \p C if
/// no new SCCs have been split out, or it will be the new SCC containing \p N.
template <typename SCCRangeT>
-LazyCallGraph::SCC *
+static LazyCallGraph::SCC *
incorporateNewSCCRange(const SCCRangeT &NewSCCRange, LazyCallGraph &G,
LazyCallGraph::Node &N, LazyCallGraph::SCC *C,
CGSCCAnalysisManager &AM, CGSCCUpdateResult &UR) {
- typedef LazyCallGraph::SCC SCC;
+ using SCC = LazyCallGraph::SCC;
if (NewSCCRange.begin() == NewSCCRange.end())
return C;
@@ -363,8 +379,8 @@ incorporateNewSCCRange(const SCCRangeT &NewSCCRange, LazyCallGraph &G,
if (NeedFAMProxy)
updateNewSCCFunctionAnalyses(*C, G, AM);
- for (SCC &NewC :
- reverse(make_range(std::next(NewSCCRange.begin()), NewSCCRange.end()))) {
+ for (SCC &NewC : llvm::reverse(make_range(std::next(NewSCCRange.begin()),
+ NewSCCRange.end()))) {
assert(C != &NewC && "No need to re-visit the current SCC!");
assert(OldC != &NewC && "Already handled the original SCC!");
UR.CWorklist.insert(&NewC);
@@ -380,15 +396,14 @@ incorporateNewSCCRange(const SCCRangeT &NewSCCRange, LazyCallGraph &G,
}
return C;
}
-}
LazyCallGraph::SCC &llvm::updateCGAndAnalysisManagerForFunctionPass(
LazyCallGraph &G, LazyCallGraph::SCC &InitialC, LazyCallGraph::Node &N,
CGSCCAnalysisManager &AM, CGSCCUpdateResult &UR) {
- typedef LazyCallGraph::Node Node;
- typedef LazyCallGraph::Edge Edge;
- typedef LazyCallGraph::SCC SCC;
- typedef LazyCallGraph::RefSCC RefSCC;
+ using Node = LazyCallGraph::Node;
+ using Edge = LazyCallGraph::Edge;
+ using SCC = LazyCallGraph::SCC;
+ using RefSCC = LazyCallGraph::RefSCC;
RefSCC &InitialRC = InitialC.getOuterRefSCC();
SCC *C = &InitialC;
@@ -430,7 +445,7 @@ LazyCallGraph::SCC &llvm::updateCGAndAnalysisManagerForFunctionPass(
// Now walk all references.
for (Instruction &I : instructions(F))
for (Value *Op : I.operand_values())
- if (Constant *C = dyn_cast<Constant>(Op))
+ if (auto *C = dyn_cast<Constant>(Op))
if (Visited.insert(C).second)
Worklist.push_back(C);
@@ -521,8 +536,8 @@ LazyCallGraph::SCC &llvm::updateCGAndAnalysisManagerForFunctionPass(
// "bottom" we will continue processing in the bottom-up walk.
assert(NewRefSCCs.front() == RC &&
"New current RefSCC not first in the returned list!");
- for (RefSCC *NewRC :
- reverse(make_range(std::next(NewRefSCCs.begin()), NewRefSCCs.end()))) {
+ for (RefSCC *NewRC : llvm::reverse(make_range(std::next(NewRefSCCs.begin()),
+ NewRefSCCs.end()))) {
assert(NewRC != RC && "Should not encounter the current RefSCC further "
"in the postorder list of new RefSCCs.");
UR.RCWorklist.insert(NewRC);
@@ -644,8 +659,8 @@ LazyCallGraph::SCC &llvm::updateCGAndAnalysisManagerForFunctionPass(
DEBUG(dbgs() << "Enqueuing the existing SCC in the worklist: " << *C
<< "\n");
// Enqueue in reverse order as we pop off the back of the worklist.
- for (SCC &MovedC : reverse(make_range(RC->begin() + InitialSCCIndex,
- RC->begin() + NewSCCIndex))) {
+ for (SCC &MovedC : llvm::reverse(make_range(RC->begin() + InitialSCCIndex,
+ RC->begin() + NewSCCIndex))) {
UR.CWorklist.insert(&MovedC);
DEBUG(dbgs() << "Enqueuing a newly earlier in post-order SCC: "
<< MovedC << "\n");
OpenPOWER on IntegriCloud