[llvm] r310766 - [Analysis] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).
Eugene Zelenko via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 11 14:30:03 PDT 2017
Author: eugenezelenko
Date: Fri Aug 11 14:30:02 2017
New Revision: 310766
URL: http://llvm.org/viewvc/llvm-project?rev=310766&view=rev
Log:
[Analysis] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).
Modified:
llvm/trunk/include/llvm/Analysis/AliasAnalysis.h
llvm/trunk/include/llvm/Analysis/BasicAliasAnalysis.h
llvm/trunk/include/llvm/Analysis/CFLAndersAliasAnalysis.h
llvm/trunk/include/llvm/Analysis/CFLSteensAliasAnalysis.h
llvm/trunk/include/llvm/Analysis/LazyCallGraph.h
llvm/trunk/lib/Analysis/AliasAnalysis.cpp
llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
llvm/trunk/lib/Analysis/CFLAndersAliasAnalysis.cpp
llvm/trunk/lib/Analysis/CFLGraph.h
llvm/trunk/lib/Analysis/CFLSteensAliasAnalysis.cpp
llvm/trunk/lib/Analysis/LazyCallGraph.cpp
Modified: llvm/trunk/include/llvm/Analysis/AliasAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/AliasAnalysis.h?rev=310766&r1=310765&r2=310766&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/AliasAnalysis.h (original)
+++ llvm/trunk/include/llvm/Analysis/AliasAnalysis.h Fri Aug 11 14:30:02 2017
@@ -38,25 +38,30 @@
#ifndef LLVM_ANALYSIS_ALIASANALYSIS_H
#define LLVM_ANALYSIS_ALIASANALYSIS_H
+#include "llvm/ADT/None.h"
#include "llvm/ADT/Optional.h"
+#include "llvm/ADT/SmallVector.h"
#include "llvm/Analysis/MemoryLocation.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/IR/CallSite.h"
-#include "llvm/IR/Metadata.h"
+#include "llvm/IR/Function.h"
+#include "llvm/IR/Instruction.h"
+#include "llvm/IR/Instructions.h"
#include "llvm/IR/PassManager.h"
+#include "llvm/Pass.h"
+#include <cstdint>
+#include <functional>
+#include <memory>
+#include <vector>
namespace llvm {
-class BasicAAResult;
-class LoadInst;
-class StoreInst;
-class VAArgInst;
-class DataLayout;
-class Pass;
+
class AnalysisUsage;
-class MemTransferInst;
-class MemIntrinsic;
+class BasicAAResult;
+class BasicBlock;
class DominatorTree;
class OrderedBasicBlock;
+class Value;
/// The possible results of an alias query.
///
@@ -611,6 +616,7 @@ public:
private:
class Concept;
+
template <typename T> class Model;
template <typename T> friend class AAResultBase;
@@ -624,7 +630,7 @@ private:
/// Temporary typedef for legacy code that uses a generic \c AliasAnalysis
/// pointer or reference.
-typedef AAResults AliasAnalysis;
+using AliasAnalysis = AAResults;
/// A private abstract base class describing the concept of an individual alias
/// analysis implementation.
@@ -705,7 +711,7 @@ public:
explicit Model(AAResultT &Result, AAResults &AAR) : Result(Result) {
Result.setAAResults(&AAR);
}
- ~Model() override {}
+ ~Model() override = default;
void setAAResults(AAResults *NewAAR) override { Result.setAAResults(NewAAR); }
@@ -815,7 +821,7 @@ protected:
}
};
- explicit AAResultBase() {}
+ explicit AAResultBase() = default;
// Provide all the copy and move constructors so that derived types aren't
// constrained.
@@ -864,7 +870,6 @@ public:
}
};
-
/// Return true if this pointer is returned by a noalias function.
bool isNoAliasCall(const Value *V);
@@ -901,7 +906,7 @@ bool isIdentifiedFunctionLocal(const Val
/// ensure the analysis itself is registered with its AnalysisManager.
class AAManager : public AnalysisInfoMixin<AAManager> {
public:
- typedef AAResults Result;
+ using Result = AAResults;
/// Register a specific AA result.
template <typename AnalysisT> void registerFunctionAnalysis() {
@@ -922,6 +927,7 @@ public:
private:
friend AnalysisInfoMixin<AAManager>;
+
static AnalysisKey Key;
SmallVector<void (*)(Function &F, FunctionAnalysisManager &AM,
@@ -992,6 +998,6 @@ AAResults createLegacyPMAAResults(Pass &
/// sure the analyses required by \p createLegacyPMAAResults are available.
void getAAResultsAnalysisUsage(AnalysisUsage &AU);
-} // End llvm namespace
+} // end namespace llvm
-#endif
+#endif // LLVM_ANALYSIS_ALIASANALYSIS_H
Modified: llvm/trunk/include/llvm/Analysis/BasicAliasAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/BasicAliasAnalysis.h?rev=310766&r1=310765&r2=310766&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/BasicAliasAnalysis.h (original)
+++ llvm/trunk/include/llvm/Analysis/BasicAliasAnalysis.h Fri Aug 11 14:30:02 2017
@@ -14,22 +14,36 @@
#ifndef LLVM_ANALYSIS_BASICALIASANALYSIS_H
#define LLVM_ANALYSIS_BASICALIASANALYSIS_H
+#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/Optional.h"
#include "llvm/ADT/SmallPtrSet.h"
+#include "llvm/ADT/SmallVector.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/AssumptionCache.h"
-#include "llvm/Analysis/TargetLibraryInfo.h"
-#include "llvm/IR/Function.h"
-#include "llvm/IR/GetElementPtrTypeIterator.h"
-#include "llvm/IR/Instruction.h"
-#include "llvm/IR/LLVMContext.h"
-#include "llvm/IR/Module.h"
+#include "llvm/Analysis/MemoryLocation.h"
+#include "llvm/IR/CallSite.h"
#include "llvm/IR/PassManager.h"
-#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Pass.h"
+#include <algorithm>
+#include <cstdint>
+#include <memory>
+#include <utility>
namespace llvm {
+
+struct AAMDNodes;
+class APInt;
class AssumptionCache;
+class BasicBlock;
+class DataLayout;
class DominatorTree;
+class Function;
+class GEPOperator;
class LoopInfo;
+class PHINode;
+class SelectInst;
+class TargetLibraryInfo;
+class Value;
/// This is the AA result object for the basic, local, and stateless alias
/// analysis. It implements the AA query interface in an entirely stateless
@@ -86,7 +100,6 @@ private:
// A linear transformation of a Value; this class represents ZExt(SExt(V,
// SExtBits), ZExtBits) * Scale + Offset.
struct VariableGEPIndex {
-
// An opaque Value - we can't decompose this further.
const Value *V;
@@ -124,8 +137,8 @@ private:
};
/// Track alias queries to guard against recursion.
- typedef std::pair<MemoryLocation, MemoryLocation> LocPair;
- typedef SmallDenseMap<LocPair, AliasResult, 8> AliasCacheTy;
+ using LocPair = std::pair<MemoryLocation, MemoryLocation>;
+ using AliasCacheTy = SmallDenseMap<LocPair, AliasResult, 8>;
AliasCacheTy AliasCache;
/// Tracks phi nodes we have visited.
@@ -201,10 +214,11 @@ private:
/// Analysis pass providing a never-invalidated alias analysis result.
class BasicAA : public AnalysisInfoMixin<BasicAA> {
friend AnalysisInfoMixin<BasicAA>;
+
static AnalysisKey Key;
public:
- typedef BasicAAResult Result;
+ using Result = BasicAAResult;
BasicAAResult run(Function &F, FunctionAnalysisManager &AM);
};
@@ -251,6 +265,6 @@ public:
}
};
-}
+} // end namespace llvm
-#endif
+#endif // LLVM_ANALYSIS_BASICALIASANALYSIS_H
Modified: llvm/trunk/include/llvm/Analysis/CFLAndersAliasAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/CFLAndersAliasAnalysis.h?rev=310766&r1=310765&r2=310766&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/CFLAndersAliasAnalysis.h (original)
+++ llvm/trunk/include/llvm/Analysis/CFLAndersAliasAnalysis.h Fri Aug 11 14:30:02 2017
@@ -1,4 +1,4 @@
-//=- CFLAndersAliasAnalysis.h - Unification-based Alias Analysis ---*- C++-*-=//
+//==- CFLAndersAliasAnalysis.h - Unification-based Alias Analysis -*- C++-*-==//
//
// The LLVM Compiler Infrastructure
//
@@ -19,25 +19,31 @@
#include "llvm/ADT/Optional.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/CFLAliasAnalysisUtils.h"
-#include "llvm/IR/Function.h"
+#include "llvm/IR/PassManager.h"
#include "llvm/Pass.h"
#include <forward_list>
+#include <memory>
namespace llvm {
+class Function;
+class MemoryLocation;
class TargetLibraryInfo;
namespace cflaa {
+
struct AliasSummary;
-}
+
+} // end namespace cflaa
class CFLAndersAAResult : public AAResultBase<CFLAndersAAResult> {
friend AAResultBase<CFLAndersAAResult>;
+
class FunctionInfo;
public:
- explicit CFLAndersAAResult(const TargetLibraryInfo &);
- CFLAndersAAResult(CFLAndersAAResult &&);
+ explicit CFLAndersAAResult(const TargetLibraryInfo &TLI);
+ CFLAndersAAResult(CFLAndersAAResult &&RHS);
~CFLAndersAAResult();
/// Handle invalidation events from the new pass manager.
@@ -46,6 +52,7 @@ public:
FunctionAnalysisManager::Invalidator &) {
return false;
}
+
/// Evict the given function from cache
void evict(const Function *Fn);
@@ -85,10 +92,11 @@ private:
/// in particular to leverage invalidation to trigger re-computation.
class CFLAndersAA : public AnalysisInfoMixin<CFLAndersAA> {
friend AnalysisInfoMixin<CFLAndersAA>;
+
static AnalysisKey Key;
public:
- typedef CFLAndersAAResult Result;
+ using Result = CFLAndersAAResult;
CFLAndersAAResult run(Function &F, FunctionAnalysisManager &AM);
};
@@ -109,12 +117,10 @@ public:
void getAnalysisUsage(AnalysisUsage &AU) const override;
};
-//===--------------------------------------------------------------------===//
-//
// createCFLAndersAAWrapperPass - This pass implements a set-based approach to
// alias analysis.
-//
ImmutablePass *createCFLAndersAAWrapperPass();
-}
-#endif
+} // end namespace llvm
+
+#endif // LLVM_ANALYSIS_CFLANDERSALIASANALYSIS_H
Modified: llvm/trunk/include/llvm/Analysis/CFLSteensAliasAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/CFLSteensAliasAnalysis.h?rev=310766&r1=310765&r2=310766&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/CFLSteensAliasAnalysis.h (original)
+++ llvm/trunk/include/llvm/Analysis/CFLSteensAliasAnalysis.h Fri Aug 11 14:30:02 2017
@@ -1,4 +1,4 @@
-//=- CFLSteensAliasAnalysis.h - Unification-based Alias Analysis ---*- C++-*-=//
+//==- CFLSteensAliasAnalysis.h - Unification-based Alias Analysis -*- C++-*-==//
//
// The LLVM Compiler Infrastructure
//
@@ -16,30 +16,34 @@
#define LLVM_ANALYSIS_CFLSTEENSALIASANALYSIS_H
#include "llvm/ADT/DenseMap.h"
-#include "llvm/ADT/None.h"
#include "llvm/ADT/Optional.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/CFLAliasAnalysisUtils.h"
-#include "llvm/IR/Function.h"
-#include "llvm/IR/Module.h"
-#include "llvm/IR/ValueHandle.h"
+#include "llvm/Analysis/MemoryLocation.h"
+#include "llvm/IR/PassManager.h"
#include "llvm/Pass.h"
+#include "llvm/Support/Casting.h"
#include <forward_list>
+#include <memory>
namespace llvm {
+class Function;
class TargetLibraryInfo;
namespace cflaa {
+
struct AliasSummary;
-}
+
+} // end namespace cflaa
class CFLSteensAAResult : public AAResultBase<CFLSteensAAResult> {
friend AAResultBase<CFLSteensAAResult>;
+
class FunctionInfo;
public:
- explicit CFLSteensAAResult(const TargetLibraryInfo &);
+ explicit CFLSteensAAResult(const TargetLibraryInfo &TLI);
CFLSteensAAResult(CFLSteensAAResult &&Arg);
~CFLSteensAAResult();
@@ -105,10 +109,11 @@ private:
/// in particular to leverage invalidation to trigger re-computation of sets.
class CFLSteensAA : public AnalysisInfoMixin<CFLSteensAA> {
friend AnalysisInfoMixin<CFLSteensAA>;
+
static AnalysisKey Key;
public:
- typedef CFLSteensAAResult Result;
+ using Result = CFLSteensAAResult;
CFLSteensAAResult run(Function &F, FunctionAnalysisManager &AM);
};
@@ -129,12 +134,10 @@ public:
void getAnalysisUsage(AnalysisUsage &AU) const override;
};
-//===--------------------------------------------------------------------===//
-//
// createCFLSteensAAWrapperPass - This pass implements a set-based approach to
// alias analysis.
-//
ImmutablePass *createCFLSteensAAWrapperPass();
-}
-#endif
+} // end namespace llvm
+
+#endif // LLVM_ANALYSIS_CFLSTEENSALIASANALYSIS_H
Modified: llvm/trunk/include/llvm/Analysis/LazyCallGraph.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LazyCallGraph.h?rev=310766&r1=310765&r2=310766&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/LazyCallGraph.h (original)
+++ llvm/trunk/include/llvm/Analysis/LazyCallGraph.h Fri Aug 11 14:30:02 2017
@@ -35,28 +35,33 @@
#ifndef LLVM_ANALYSIS_LAZYCALLGRAPH_H
#define LLVM_ANALYSIS_LAZYCALLGRAPH_H
+#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
-#include "llvm/ADT/PointerUnion.h"
-#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/Optional.h"
+#include "llvm/ADT/PointerIntPair.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/iterator.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
-#include "llvm/IR/BasicBlock.h"
+#include "llvm/IR/Constant.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/Function.h"
-#include "llvm/IR/Module.h"
#include "llvm/IR/PassManager.h"
#include "llvm/Support/Allocator.h"
+#include "llvm/Support/Casting.h"
#include "llvm/Support/raw_ostream.h"
+#include <cassert>
#include <iterator>
+#include <string>
#include <utility>
namespace llvm {
-class PreservedAnalyses;
-class raw_ostream;
+
+class Module;
+class Value;
/// A lazily constructed view of the call graph of a module.
///
@@ -183,8 +188,8 @@ public:
friend class LazyCallGraph::Node;
friend class LazyCallGraph::RefSCC;
- typedef SmallVector<Edge, 4> VectorT;
- typedef SmallVectorImpl<Edge> VectorImplT;
+ using VectorT = SmallVector<Edge, 4>;
+ using VectorImplT = SmallVectorImpl<Edge>;
public:
/// An iterator used for the edges to both entry nodes and child nodes.
@@ -204,7 +209,7 @@ public:
}
public:
- iterator() {}
+ iterator() = default;
using iterator_adaptor_base::operator++;
iterator &operator++() {
@@ -240,7 +245,7 @@ public:
}
public:
- call_iterator() {}
+ call_iterator() = default;
using iterator_adaptor_base::operator++;
call_iterator &operator++() {
@@ -260,6 +265,7 @@ public:
assert(E && "Dead or null edge!");
return E;
}
+
Edge *lookup(Node &N) {
auto EI = EdgeIndexMap.find(&N);
if (EI == EdgeIndexMap.end())
@@ -381,15 +387,14 @@ public:
// We provide for the DFS numbering and Tarjan walk lowlink numbers to be
// stored directly within the node. These are both '-1' when nodes are part
// of an SCC (or RefSCC), or '0' when not yet reached in a DFS walk.
- int DFSNumber;
- int LowLink;
+ int DFSNumber = 0;
+ int LowLink = 0;
Optional<EdgeSequence> Edges;
/// Basic constructor implements the scanning of F into Edges and
/// EdgeIndexMap.
- Node(LazyCallGraph &G, Function &F)
- : G(&G), F(&F), DFSNumber(0), LowLink(0) {}
+ Node(LazyCallGraph &G, Function &F) : G(&G), F(&F) {}
/// Implementation of the scan when populating.
EdgeSequence &populateSlow();
@@ -478,7 +483,7 @@ public:
#endif
public:
- typedef pointee_iterator<SmallVectorImpl<Node *>::const_iterator> iterator;
+ using iterator = pointee_iterator<SmallVectorImpl<Node *>::const_iterator>;
iterator begin() const { return Nodes.begin(); }
iterator end() const { return Nodes.end(); }
@@ -606,10 +611,10 @@ public:
void handleTrivialEdgeInsertion(Node &SourceN, Node &TargetN);
public:
- typedef pointee_iterator<SmallVectorImpl<SCC *>::const_iterator> iterator;
- typedef iterator_range<iterator> range;
- typedef pointee_iterator<SmallPtrSetImpl<RefSCC *>::const_iterator>
- parent_iterator;
+ using iterator = pointee_iterator<SmallVectorImpl<SCC *>::const_iterator>;
+ using range = iterator_range<iterator>;
+ using parent_iterator =
+ pointee_iterator<SmallPtrSetImpl<RefSCC *>::const_iterator>;
iterator begin() const { return SCCs.begin(); }
iterator end() const { return SCCs.end(); }
@@ -888,14 +893,13 @@ public:
struct IsAtEndT {};
LazyCallGraph *G;
- RefSCC *RC;
+ RefSCC *RC = nullptr;
/// Build the begin iterator for a node.
postorder_ref_scc_iterator(LazyCallGraph &G) : G(&G), RC(getRC(G, 0)) {}
/// Build the end iterator for a node. This is selected purely by overload.
- postorder_ref_scc_iterator(LazyCallGraph &G, IsAtEndT /*Nonce*/)
- : G(&G), RC(nullptr) {}
+ postorder_ref_scc_iterator(LazyCallGraph &G, IsAtEndT /*Nonce*/) : G(&G) {}
/// Get the post-order RefSCC at the given index of the postorder walk,
/// populating it if necessary.
@@ -1097,8 +1101,8 @@ public:
///@}
private:
- typedef SmallVectorImpl<Node *>::reverse_iterator node_stack_iterator;
- typedef iterator_range<node_stack_iterator> node_stack_range;
+ using node_stack_iterator = SmallVectorImpl<Node *>::reverse_iterator;
+ using node_stack_range = iterator_range<node_stack_iterator>;
/// Allocator that holds all the call graph nodes.
SpecificBumpPtrAllocator<Node> BPA;
@@ -1218,16 +1222,16 @@ inline Function &LazyCallGraph::Edge::ge
// Provide GraphTraits specializations for call graphs.
template <> struct GraphTraits<LazyCallGraph::Node *> {
- typedef LazyCallGraph::Node *NodeRef;
- typedef LazyCallGraph::EdgeSequence::iterator ChildIteratorType;
+ using NodeRef = LazyCallGraph::Node *;
+ using ChildIteratorType = LazyCallGraph::EdgeSequence::iterator;
static NodeRef getEntryNode(NodeRef N) { return N; }
static ChildIteratorType child_begin(NodeRef N) { return (*N)->begin(); }
static ChildIteratorType child_end(NodeRef N) { return (*N)->end(); }
};
template <> struct GraphTraits<LazyCallGraph *> {
- typedef LazyCallGraph::Node *NodeRef;
- typedef LazyCallGraph::EdgeSequence::iterator ChildIteratorType;
+ using NodeRef = LazyCallGraph::Node *;
+ using ChildIteratorType = LazyCallGraph::EdgeSequence::iterator;
static NodeRef getEntryNode(NodeRef N) { return N; }
static ChildIteratorType child_begin(NodeRef N) { return (*N)->begin(); }
@@ -1237,11 +1241,12 @@ template <> struct GraphTraits<LazyCallG
/// An analysis pass which computes the call graph for a module.
class LazyCallGraphAnalysis : public AnalysisInfoMixin<LazyCallGraphAnalysis> {
friend AnalysisInfoMixin<LazyCallGraphAnalysis>;
+
static AnalysisKey Key;
public:
/// Inform generic clients of the result type.
- typedef LazyCallGraph Result;
+ using Result = LazyCallGraph;
/// Compute the \c LazyCallGraph for the module \c M.
///
@@ -1277,6 +1282,7 @@ public:
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
};
-}
-#endif
+} // end namespace llvm
+
+#endif // LLVM_ANALYSIS_LAZYCALLGRAPH_H
Modified: llvm/trunk/lib/Analysis/AliasAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/AliasAnalysis.cpp?rev=310766&r1=310765&r2=310766&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/AliasAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/AliasAnalysis.cpp Fri Aug 11 14:30:02 2017
@@ -1,4 +1,4 @@
-//===- AliasAnalysis.cpp - Generic Alias Analysis Interface Implementation -==//
+//==- AliasAnalysis.cpp - Generic Alias Analysis Interface Implementation --==//
//
// The LLVM Compiler Infrastructure
//
@@ -26,26 +26,35 @@
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/BasicAliasAnalysis.h"
-#include "llvm/Analysis/CFG.h"
#include "llvm/Analysis/CFLAndersAliasAnalysis.h"
#include "llvm/Analysis/CFLSteensAliasAnalysis.h"
#include "llvm/Analysis/CaptureTracking.h"
#include "llvm/Analysis/GlobalsModRef.h"
+#include "llvm/Analysis/MemoryLocation.h"
#include "llvm/Analysis/ObjCARCAliasAnalysis.h"
#include "llvm/Analysis/ScalarEvolutionAliasAnalysis.h"
#include "llvm/Analysis/ScopedNoAliasAA.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/Analysis/TypeBasedAliasAnalysis.h"
#include "llvm/Analysis/ValueTracking.h"
+#include "llvm/IR/Argument.h"
+#include "llvm/IR/Attributes.h"
#include "llvm/IR/BasicBlock.h"
-#include "llvm/IR/DataLayout.h"
-#include "llvm/IR/Dominators.h"
-#include "llvm/IR/Function.h"
+#include "llvm/IR/CallSite.h"
+#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
-#include "llvm/IR/IntrinsicInst.h"
-#include "llvm/IR/LLVMContext.h"
+#include "llvm/IR/Module.h"
#include "llvm/IR/Type.h"
+#include "llvm/IR/Value.h"
#include "llvm/Pass.h"
+#include "llvm/Support/AtomicOrdering.h"
+#include "llvm/Support/Casting.h"
+#include "llvm/Support/CommandLine.h"
+#include <algorithm>
+#include <cassert>
+#include <functional>
+#include <iterator>
+
using namespace llvm;
/// Allow disabling BasicAA from the AA results. This is particularly useful
@@ -377,7 +386,6 @@ ModRefInfo AAResults::getModRefInfo(cons
ModRefInfo AAResults::getModRefInfo(const VAArgInst *V,
const MemoryLocation &Loc) {
-
if (Loc.Ptr) {
// If the va_arg address cannot alias the pointer in question, then the
// specified memory cannot be accessed by the va_arg.
@@ -471,10 +479,10 @@ ModRefInfo AAResults::callCapturesBefore
if (!CS.getInstruction() || CS.getInstruction() == Object)
return MRI_ModRef;
- if (llvm::PointerMayBeCapturedBefore(Object, /* ReturnCaptures */ true,
- /* StoreCaptures */ true, I, DT,
- /* include Object */ true,
- /* OrderedBasicBlock */ OBB))
+ if (PointerMayBeCapturedBefore(Object, /* ReturnCaptures */ true,
+ /* StoreCaptures */ true, I, DT,
+ /* include Object */ true,
+ /* OrderedBasicBlock */ OBB))
return MRI_ModRef;
unsigned ArgNo = 0;
@@ -536,16 +544,17 @@ bool AAResults::canInstructionRangeModRe
}
// Provide a definition for the root virtual destructor.
-AAResults::Concept::~Concept() {}
+AAResults::Concept::~Concept() = default;
// Provide a definition for the static object used to identify passes.
AnalysisKey AAManager::Key;
namespace {
+
/// A wrapper pass for external alias analyses. This just squirrels away the
/// callback used to run any analyses and register their results.
struct ExternalAAWrapperPass : ImmutablePass {
- typedef std::function<void(Pass &, Function &, AAResults &)> CallbackT;
+ using CallbackT = std::function<void(Pass &, Function &, AAResults &)>;
CallbackT CB;
@@ -554,6 +563,7 @@ struct ExternalAAWrapperPass : Immutable
ExternalAAWrapperPass() : ImmutablePass(ID) {
initializeExternalAAWrapperPassPass(*PassRegistry::getPassRegistry());
}
+
explicit ExternalAAWrapperPass(CallbackT CB)
: ImmutablePass(ID), CB(std::move(CB)) {
initializeExternalAAWrapperPassPass(*PassRegistry::getPassRegistry());
@@ -563,9 +573,11 @@ struct ExternalAAWrapperPass : Immutable
AU.setPreservesAll();
}
};
-}
+
+} // end anonymous namespace
char ExternalAAWrapperPass::ID = 0;
+
INITIALIZE_PASS(ExternalAAWrapperPass, "external-aa", "External Alias Analysis",
false, true)
Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp?rev=310766&r1=310765&r2=310766&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Fri Aug 11 14:30:02 2017
@@ -14,6 +14,8 @@
//===----------------------------------------------------------------------===//
#include "llvm/Analysis/BasicAliasAnalysis.h"
+#include "llvm/ADT/APInt.h"
+#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AliasAnalysis.h"
@@ -23,21 +25,40 @@
#include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/MemoryBuiltins.h"
+#include "llvm/Analysis/MemoryLocation.h"
+#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/Analysis/ValueTracking.h"
+#include "llvm/IR/Argument.h"
+#include "llvm/IR/Attributes.h"
+#include "llvm/IR/CallSite.h"
+#include "llvm/IR/Constant.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Dominators.h"
+#include "llvm/IR/Function.h"
+#include "llvm/IR/GetElementPtrTypeIterator.h"
#include "llvm/IR/GlobalAlias.h"
#include "llvm/IR/GlobalVariable.h"
+#include "llvm/IR/InstrTypes.h"
+#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
-#include "llvm/IR/LLVMContext.h"
+#include "llvm/IR/Intrinsics.h"
+#include "llvm/IR/Metadata.h"
#include "llvm/IR/Operator.h"
+#include "llvm/IR/Type.h"
+#include "llvm/IR/User.h"
+#include "llvm/IR/Value.h"
#include "llvm/Pass.h"
-#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/Casting.h"
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/KnownBits.h"
-#include <algorithm>
+#include <cassert>
+#include <cstdint>
+#include <cstdlib>
+#include <utility>
#define DEBUG_TYPE "basicaa"
@@ -223,7 +244,6 @@ static bool isObjectSize(const Value *V,
if (const BinaryOperator *BOp = dyn_cast<BinaryOperator>(V)) {
if (ConstantInt *RHSC = dyn_cast<ConstantInt>(BOp->getOperand(1))) {
-
// If we've been called recursively, then Offset and Scale will be wider
// than the BOp operands. We'll always zext it here as we'll process sign
// extensions below (see the isa<SExtInst> / isa<ZExtInst> cases).
@@ -574,7 +594,6 @@ bool BasicAAResult::pointsToConstantMemo
// Otherwise be conservative.
Visited.clear();
return AAResultBase::pointsToConstantMemory(Loc, OrLocal);
-
} while (!Worklist.empty() && --MaxLookup);
Visited.clear();
@@ -662,7 +681,6 @@ static bool isWriteOnlyParam(ImmutableCa
ModRefInfo BasicAAResult::getArgModRefInfo(ImmutableCallSite CS,
unsigned ArgIdx) {
-
// Checking for known builtin intrinsics and target library functions.
if (isWriteOnlyParam(CS, ArgIdx, TLI))
return MRI_Mod;
@@ -927,7 +945,6 @@ static AliasResult aliasSameBasePointerG
const GEPOperator *GEP2,
uint64_t V2Size,
const DataLayout &DL) {
-
assert(GEP1->getPointerOperand()->stripPointerCastsAndBarriers() ==
GEP2->getPointerOperand()->stripPointerCastsAndBarriers() &&
GEP1->getPointerOperandType() == GEP2->getPointerOperandType() &&
@@ -1814,6 +1831,7 @@ BasicAAWrapperPass::BasicAAWrapperPass()
}
char BasicAAWrapperPass::ID = 0;
+
void BasicAAWrapperPass::anchor() {}
INITIALIZE_PASS_BEGIN(BasicAAWrapperPass, "basicaa",
Modified: llvm/trunk/lib/Analysis/CFLAndersAliasAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/CFLAndersAliasAnalysis.cpp?rev=310766&r1=310765&r2=310766&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/CFLAndersAliasAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/CFLAndersAliasAnalysis.cpp Fri Aug 11 14:30:02 2017
@@ -1,4 +1,4 @@
-//- CFLAndersAliasAnalysis.cpp - Unification-based Alias Analysis ---*- C++-*-//
+//===- CFLAndersAliasAnalysis.cpp - Unification-based Alias Analysis ------===//
//
// The LLVM Compiler Infrastructure
//
@@ -54,9 +54,35 @@
// FunctionPasses to run concurrently.
#include "llvm/Analysis/CFLAndersAliasAnalysis.h"
+#include "AliasAnalysisSummary.h"
#include "CFLGraph.h"
+#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/DenseMapInfo.h"
#include "llvm/ADT/DenseSet.h"
+#include "llvm/ADT/None.h"
+#include "llvm/ADT/Optional.h"
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/iterator_range.h"
+#include "llvm/Analysis/AliasAnalysis.h"
+#include "llvm/Analysis/MemoryLocation.h"
+#include "llvm/IR/Argument.h"
+#include "llvm/IR/Function.h"
+#include "llvm/IR/PassManager.h"
+#include "llvm/IR/Type.h"
#include "llvm/Pass.h"
+#include "llvm/Support/Casting.h"
+#include "llvm/Support/Compiler.h"
+#include "llvm/Support/Debug.h"
+#include "llvm/Support/raw_ostream.h"
+#include <algorithm>
+#include <bitset>
+#include <cassert>
+#include <cstddef>
+#include <cstdint>
+#include <functional>
+#include <utility>
+#include <vector>
using namespace llvm;
using namespace llvm::cflaa;
@@ -66,7 +92,7 @@ using namespace llvm::cflaa;
CFLAndersAAResult::CFLAndersAAResult(const TargetLibraryInfo &TLI) : TLI(TLI) {}
CFLAndersAAResult::CFLAndersAAResult(CFLAndersAAResult &&RHS)
: AAResultBase(std::move(RHS)), TLI(RHS.TLI) {}
-CFLAndersAAResult::~CFLAndersAAResult() {}
+CFLAndersAAResult::~CFLAndersAAResult() = default;
namespace {
@@ -95,7 +121,8 @@ enum class MatchState : uint8_t {
FlowToMemAliasReadWrite,
};
-typedef std::bitset<7> StateSet;
+using StateSet = std::bitset<7>;
+
const unsigned ReadOnlyStateMask =
(1U << static_cast<uint8_t>(MatchState::FlowFromReadOnly)) |
(1U << static_cast<uint8_t>(MatchState::FlowFromMemAliasReadOnly));
@@ -130,13 +157,14 @@ bool operator==(OffsetInstantiatedValue
// We use ReachabilitySet to keep track of value aliases (The nonterminal "V" in
// the paper) during the analysis.
class ReachabilitySet {
- typedef DenseMap<InstantiatedValue, StateSet> ValueStateMap;
- typedef DenseMap<InstantiatedValue, ValueStateMap> ValueReachMap;
+ using ValueStateMap = DenseMap<InstantiatedValue, StateSet>;
+ using ValueReachMap = DenseMap<InstantiatedValue, ValueStateMap>;
+
ValueReachMap ReachMap;
public:
- typedef ValueStateMap::const_iterator const_valuestate_iterator;
- typedef ValueReachMap::const_iterator const_value_iterator;
+ using const_valuestate_iterator = ValueStateMap::const_iterator;
+ using const_value_iterator = ValueReachMap::const_iterator;
// Insert edge 'From->To' at state 'State'
bool insert(InstantiatedValue From, InstantiatedValue To, MatchState State) {
@@ -169,12 +197,13 @@ public:
// We use AliasMemSet to keep track of all memory aliases (the nonterminal "M"
// in the paper) during the analysis.
class AliasMemSet {
- typedef DenseSet<InstantiatedValue> MemSet;
- typedef DenseMap<InstantiatedValue, MemSet> MemMapType;
+ using MemSet = DenseSet<InstantiatedValue>;
+ using MemMapType = DenseMap<InstantiatedValue, MemSet>;
+
MemMapType MemMap;
public:
- typedef MemSet::const_iterator const_mem_iterator;
+ using const_mem_iterator = MemSet::const_iterator;
bool insert(InstantiatedValue LHS, InstantiatedValue RHS) {
// Top-level values can never be memory aliases because one cannot take the
@@ -193,11 +222,12 @@ public:
// We use AliasAttrMap to keep track of the AliasAttr of each node.
class AliasAttrMap {
- typedef DenseMap<InstantiatedValue, AliasAttrs> MapType;
+ using MapType = DenseMap<InstantiatedValue, AliasAttrs>;
+
MapType AttrMap;
public:
- typedef MapType::const_iterator const_iterator;
+ using const_iterator = MapType::const_iterator;
bool add(InstantiatedValue V, AliasAttrs Attr) {
auto &OldAttr = AttrMap[V];
@@ -234,23 +264,28 @@ struct ValueSummary {
};
SmallVector<Record, 4> FromRecords, ToRecords;
};
-}
+
+} // end anonymous namespace
namespace llvm {
+
// Specialize DenseMapInfo for OffsetValue.
template <> struct DenseMapInfo<OffsetValue> {
static OffsetValue getEmptyKey() {
return OffsetValue{DenseMapInfo<const Value *>::getEmptyKey(),
DenseMapInfo<int64_t>::getEmptyKey()};
}
+
static OffsetValue getTombstoneKey() {
return OffsetValue{DenseMapInfo<const Value *>::getTombstoneKey(),
DenseMapInfo<int64_t>::getEmptyKey()};
}
+
static unsigned getHashValue(const OffsetValue &OVal) {
return DenseMapInfo<std::pair<const Value *, int64_t>>::getHashValue(
std::make_pair(OVal.Val, OVal.Offset));
}
+
static bool isEqual(const OffsetValue &LHS, const OffsetValue &RHS) {
return LHS == RHS;
}
@@ -263,21 +298,25 @@ template <> struct DenseMapInfo<OffsetIn
DenseMapInfo<InstantiatedValue>::getEmptyKey(),
DenseMapInfo<int64_t>::getEmptyKey()};
}
+
static OffsetInstantiatedValue getTombstoneKey() {
return OffsetInstantiatedValue{
DenseMapInfo<InstantiatedValue>::getTombstoneKey(),
DenseMapInfo<int64_t>::getEmptyKey()};
}
+
static unsigned getHashValue(const OffsetInstantiatedValue &OVal) {
return DenseMapInfo<std::pair<InstantiatedValue, int64_t>>::getHashValue(
std::make_pair(OVal.IVal, OVal.Offset));
}
+
static bool isEqual(const OffsetInstantiatedValue &LHS,
const OffsetInstantiatedValue &RHS) {
return LHS == RHS;
}
};
-}
+
+} // end namespace llvm
class CFLAndersAAResult::FunctionInfo {
/// Map a value to other values that may alias it
@@ -654,41 +693,40 @@ static void processWorkListItem(const Wo
};
switch (Item.State) {
- case MatchState::FlowFromReadOnly: {
+ case MatchState::FlowFromReadOnly:
NextRevAssignState(MatchState::FlowFromReadOnly);
NextAssignState(MatchState::FlowToReadWrite);
NextMemState(MatchState::FlowFromMemAliasReadOnly);
break;
- }
- case MatchState::FlowFromMemAliasNoReadWrite: {
+
+ case MatchState::FlowFromMemAliasNoReadWrite:
NextRevAssignState(MatchState::FlowFromReadOnly);
NextAssignState(MatchState::FlowToWriteOnly);
break;
- }
- case MatchState::FlowFromMemAliasReadOnly: {
+
+ case MatchState::FlowFromMemAliasReadOnly:
NextRevAssignState(MatchState::FlowFromReadOnly);
NextAssignState(MatchState::FlowToReadWrite);
break;
- }
- case MatchState::FlowToWriteOnly: {
+
+ case MatchState::FlowToWriteOnly:
NextAssignState(MatchState::FlowToWriteOnly);
NextMemState(MatchState::FlowToMemAliasWriteOnly);
break;
- }
- case MatchState::FlowToReadWrite: {
+
+ case MatchState::FlowToReadWrite:
NextAssignState(MatchState::FlowToReadWrite);
NextMemState(MatchState::FlowToMemAliasReadWrite);
break;
- }
- case MatchState::FlowToMemAliasWriteOnly: {
+
+ case MatchState::FlowToMemAliasWriteOnly:
NextAssignState(MatchState::FlowToWriteOnly);
break;
- }
- case MatchState::FlowToMemAliasReadWrite: {
+
+ case MatchState::FlowToMemAliasReadWrite:
NextAssignState(MatchState::FlowToReadWrite);
break;
}
- }
}
static AliasAttrMap buildAttrMap(const CFLGraph &Graph,
Modified: llvm/trunk/lib/Analysis/CFLGraph.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/CFLGraph.h?rev=310766&r1=310765&r2=310766&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/CFLGraph.h (original)
+++ llvm/trunk/lib/Analysis/CFLGraph.h Fri Aug 11 14:30:02 2017
@@ -1,4 +1,4 @@
-//======- CFLGraph.h - Abstract stratified sets implementation. --------======//
+//===- CFLGraph.h - Abstract stratified sets implementation. -----*- C++-*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -6,19 +6,42 @@
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+//
/// \file
/// This file defines CFLGraph, an auxiliary data structure used by CFL-based
/// alias analysis.
-///
+//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_ANALYSIS_CFLGRAPH_H
-#define LLVM_ANALYSIS_CFLGRAPH_H
+#ifndef LLVM_LIB_ANALYSIS_CFLGRAPH_H
+#define LLVM_LIB_ANALYSIS_CFLGRAPH_H
#include "AliasAnalysisSummary.h"
+#include "llvm/ADT/APInt.h"
+#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/iterator_range.h"
#include "llvm/Analysis/MemoryBuiltins.h"
+#include "llvm/Analysis/TargetLibraryInfo.h"
+#include "llvm/IR/Argument.h"
+#include "llvm/IR/BasicBlock.h"
+#include "llvm/IR/CallSite.h"
+#include "llvm/IR/Constants.h"
+#include "llvm/IR/DataLayout.h"
+#include "llvm/IR/Function.h"
+#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/InstVisitor.h"
+#include "llvm/IR/InstrTypes.h"
+#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
+#include "llvm/IR/Operator.h"
+#include "llvm/IR/Type.h"
+#include "llvm/IR/Value.h"
+#include "llvm/Support/Casting.h"
+#include "llvm/Support/ErrorHandling.h"
+#include <cassert>
+#include <cstdint>
+#include <vector>
namespace llvm {
namespace cflaa {
@@ -35,14 +58,14 @@ namespace cflaa {
/// I+1) and a reference edge to (X, I-1).
class CFLGraph {
public:
- typedef InstantiatedValue Node;
+ using Node = InstantiatedValue;
struct Edge {
Node Other;
int64_t Offset;
};
- typedef std::vector<Edge> EdgeList;
+ using EdgeList = std::vector<Edge>;
struct NodeInfo {
EdgeList Edges, ReverseEdges;
@@ -74,7 +97,8 @@ public:
};
private:
- typedef DenseMap<Value *, ValueInfo> ValueMap;
+ using ValueMap = DenseMap<Value *, ValueInfo>;
+
ValueMap ValueImpls;
NodeInfo *getNode(Node N) {
@@ -85,7 +109,7 @@ private:
}
public:
- typedef ValueMap::const_iterator const_value_iterator;
+ using const_value_iterator = ValueMap::const_iterator;
bool addNode(Node N, AliasAttrs Attr = AliasAttrs()) {
assert(N.Val != nullptr);
@@ -496,10 +520,10 @@ template <typename CFLAA> class CFLGraph
addNode(Ptr, getAttrEscaped());
break;
}
- case Instruction::IntToPtr: {
+ case Instruction::IntToPtr:
addNode(CE, getAttrUnknown());
break;
- }
+
case Instruction::BitCast:
case Instruction::AddrSpaceCast:
case Instruction::Trunc:
@@ -571,11 +595,11 @@ template <typename CFLAA> class CFLGraph
case Instruction::LShr:
case Instruction::AShr:
case Instruction::ICmp:
- case Instruction::FCmp: {
+ case Instruction::FCmp:
addAssignEdge(CE->getOperand(0), CE);
addAssignEdge(CE->getOperand(1), CE);
break;
- }
+
default:
llvm_unreachable("Unknown instruction type encountered!");
}
@@ -640,7 +664,8 @@ public:
return ReturnedValues;
}
};
-}
-}
-#endif
+} // end namespace cflaa
+} // end namespace llvm
+
+#endif // LLVM_LIB_ANALYSIS_CFLGRAPH_H
Modified: llvm/trunk/lib/Analysis/CFLSteensAliasAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/CFLSteensAliasAnalysis.cpp?rev=310766&r1=310765&r2=310766&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/CFLSteensAliasAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/CFLSteensAliasAnalysis.cpp Fri Aug 11 14:30:02 2017
@@ -1,4 +1,4 @@
-//- CFLSteensAliasAnalysis.cpp - Unification-based Alias Analysis ---*- C++-*-//
+//===- CFLSteensAliasAnalysis.cpp - Unification-based Alias Analysis ------===//
//
// The LLVM Compiler Infrastructure
//
@@ -36,23 +36,25 @@
// FunctionPasses to run concurrently.
#include "llvm/Analysis/CFLSteensAliasAnalysis.h"
+#include "AliasAnalysisSummary.h"
#include "CFLGraph.h"
#include "StratifiedSets.h"
#include "llvm/ADT/DenseMap.h"
-#include "llvm/ADT/None.h"
#include "llvm/ADT/Optional.h"
+#include "llvm/ADT/SmallVector.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/Function.h"
+#include "llvm/IR/Type.h"
+#include "llvm/IR/Value.h"
#include "llvm/Pass.h"
-#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
-#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cassert>
+#include <limits>
#include <memory>
-#include <tuple>
+#include <utility>
using namespace llvm;
using namespace llvm::cflaa;
@@ -63,7 +65,7 @@ CFLSteensAAResult::CFLSteensAAResult(con
: AAResultBase(), TLI(TLI) {}
CFLSteensAAResult::CFLSteensAAResult(CFLSteensAAResult &&Arg)
: AAResultBase(std::move(Arg)), TLI(Arg.TLI) {}
-CFLSteensAAResult::~CFLSteensAAResult() {}
+CFLSteensAAResult::~CFLSteensAAResult() = default;
/// Information we have about a function and would like to keep around.
class CFLSteensAAResult::FunctionInfo {
@@ -77,6 +79,7 @@ public:
const StratifiedSets<InstantiatedValue> &getStratifiedSets() const {
return Sets;
}
+
const AliasSummary &getAliasSummary() const { return Summary; }
};
Modified: llvm/trunk/lib/Analysis/LazyCallGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LazyCallGraph.cpp?rev=310766&r1=310765&r2=310766&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LazyCallGraph.cpp (original)
+++ llvm/trunk/lib/Analysis/LazyCallGraph.cpp Fri Aug 11 14:30:02 2017
@@ -8,15 +8,31 @@
//===----------------------------------------------------------------------===//
#include "llvm/Analysis/LazyCallGraph.h"
+#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/ADT/Sequence.h"
+#include "llvm/ADT/SmallPtrSet.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/iterator_range.h"
+#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/IR/CallSite.h"
-#include "llvm/IR/InstVisitor.h"
-#include "llvm/IR/Instructions.h"
+#include "llvm/IR/Function.h"
+#include "llvm/IR/GlobalVariable.h"
+#include "llvm/IR/Instruction.h"
+#include "llvm/IR/Module.h"
#include "llvm/IR/PassManager.h"
+#include "llvm/Support/Casting.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/GraphWriter.h"
+#include "llvm/Support/raw_ostream.h"
+#include <algorithm>
+#include <cassert>
+#include <cstddef>
+#include <iterator>
+#include <string>
+#include <tuple>
#include <utility>
using namespace llvm;
@@ -1339,10 +1355,8 @@ void LazyCallGraph::RefSCC::handleTrivia
// after this edge insertion.
assert(G->lookupRefSCC(SourceN) == this && "Source must be in this RefSCC.");
RefSCC &TargetRC = *G->lookupRefSCC(TargetN);
- if (&TargetRC == this) {
-
+ if (&TargetRC == this)
return;
- }
#ifdef EXPENSIVE_CHECKS
assert(TargetRC.isDescendantOf(*this) &&
@@ -1544,7 +1558,7 @@ template <typename RootsT, typename GetB
void LazyCallGraph::buildGenericSCCs(RootsT &&Roots, GetBeginT &&GetBegin,
GetEndT &&GetEnd, GetNodeT &&GetNode,
FormSCCCallbackT &&FormSCC) {
- typedef decltype(GetBegin(std::declval<Node &>())) EdgeItT;
+ using EdgeItT = decltype(GetBegin(std::declval<Node &>()));
SmallVector<std::pair<Node *, EdgeItT>, 16> DFSStack;
SmallVector<Node *, 16> PendingSCCStack;
More information about the llvm-commits
mailing list