[Analysis] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 310766
diff --git a/llvm/lib/Analysis/AliasAnalysis.cpp b/llvm/lib/Analysis/AliasAnalysis.cpp
index 4c29aea..897f89d 100644
--- a/llvm/lib/Analysis/AliasAnalysis.cpp
+++ b/llvm/lib/Analysis/AliasAnalysis.cpp
@@ -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(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 @@
   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 @@
 }
 
 // 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 @@
   ExternalAAWrapperPass() : ImmutablePass(ID) {
     initializeExternalAAWrapperPassPass(*PassRegistry::getPassRegistry());
   }
+
   explicit ExternalAAWrapperPass(CallbackT CB)
       : ImmutablePass(ID), CB(std::move(CB)) {
     initializeExternalAAWrapperPassPass(*PassRegistry::getPassRegistry());
@@ -563,9 +573,11 @@
     AU.setPreservesAll();
   }
 };
-}
+
+} // end anonymous namespace
 
 char ExternalAAWrapperPass::ID = 0;
+
 INITIALIZE_PASS(ExternalAAWrapperPass, "external-aa", "External Alias Analysis",
                 false, true)
 
diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
index 180e5f4..84eb769 100644
--- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
@@ -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 @@
 
   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 @@
     // Otherwise be conservative.
     Visited.clear();
     return AAResultBase::pointsToConstantMemory(Loc, OrLocal);
-
   } while (!Worklist.empty() && --MaxLookup);
 
   Visited.clear();
@@ -662,7 +681,6 @@
 
 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 @@
                                             const GEPOperator *GEP2,
                                             uint64_t V2Size,
                                             const DataLayout &DL) {
-
   assert(GEP1->getPointerOperand()->stripPointerCastsAndBarriers() ==
              GEP2->getPointerOperand()->stripPointerCastsAndBarriers() &&
          GEP1->getPointerOperandType() == GEP2->getPointerOperandType() &&
@@ -1814,6 +1831,7 @@
 }
 
 char BasicAAWrapperPass::ID = 0;
+
 void BasicAAWrapperPass::anchor() {}
 
 INITIALIZE_PASS_BEGIN(BasicAAWrapperPass, "basicaa",
diff --git a/llvm/lib/Analysis/CFLAndersAliasAnalysis.cpp b/llvm/lib/Analysis/CFLAndersAliasAnalysis.cpp
index 1a39988..076a2b2 100644
--- a/llvm/lib/Analysis/CFLAndersAliasAnalysis.cpp
+++ b/llvm/lib/Analysis/CFLAndersAliasAnalysis.cpp
@@ -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 @@
 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 @@
   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 @@
 // 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 @@
 // 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 @@
 
 // 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 @@
   };
   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 @@
         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 @@
   };
 
   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,
diff --git a/llvm/lib/Analysis/CFLGraph.h b/llvm/lib/Analysis/CFLGraph.h
index 95874b8..e4e9286 100644
--- a/llvm/lib/Analysis/CFLGraph.h
+++ b/llvm/lib/Analysis/CFLGraph.h
@@ -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 @@
 /// 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 @@
   };
 
 private:
-  typedef DenseMap<Value *, ValueInfo> ValueMap;
+  using ValueMap = DenseMap<Value *, ValueInfo>;
+
   ValueMap ValueImpls;
 
   NodeInfo *getNode(Node N) {
@@ -85,7 +109,7 @@
   }
 
 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 @@
         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 @@
       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 @@
     return ReturnedValues;
   }
 };
-}
-}
 
-#endif
+} // end namespace cflaa
+} // end namespace llvm
+
+#endif // LLVM_LIB_ANALYSIS_CFLGRAPH_H
diff --git a/llvm/lib/Analysis/CFLSteensAliasAnalysis.cpp b/llvm/lib/Analysis/CFLSteensAliasAnalysis.cpp
index adbdd82..eee6d26 100644
--- a/llvm/lib/Analysis/CFLSteensAliasAnalysis.cpp
+++ b/llvm/lib/Analysis/CFLSteensAliasAnalysis.cpp
@@ -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 @@
     : 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 @@
   const StratifiedSets<InstantiatedValue> &getStratifiedSets() const {
     return Sets;
   }
+
   const AliasSummary &getAliasSummary() const { return Summary; }
 };
 
diff --git a/llvm/lib/Analysis/LazyCallGraph.cpp b/llvm/lib/Analysis/LazyCallGraph.cpp
index 5aeea9e..54299d0 100644
--- a/llvm/lib/Analysis/LazyCallGraph.cpp
+++ b/llvm/lib/Analysis/LazyCallGraph.cpp
@@ -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 @@
   // 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 @@
 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;