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

llvm-svn: 309062
diff --git a/llvm/lib/Target/AArch64/AArch64PromoteConstant.cpp b/llvm/lib/Target/AArch64/AArch64PromoteConstant.cpp
index 8693f76..a8dc6e7 100644
--- a/llvm/lib/Target/AArch64/AArch64PromoteConstant.cpp
+++ b/llvm/lib/Target/AArch64/AArch64PromoteConstant.cpp
@@ -1,4 +1,4 @@
-//=- AArch64PromoteConstant.cpp --- Promote constant to global for AArch64 -==//
+//==- AArch64PromoteConstant.cpp - Promote constant to global for AArch64 --==//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -22,23 +22,31 @@
 
 #include "AArch64.h"
 #include "llvm/ADT/DenseMap.h"
-#include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/Statistic.h"
+#include "llvm/IR/BasicBlock.h"
+#include "llvm/IR/Constant.h"
 #include "llvm/IR/Constants.h"
 #include "llvm/IR/Dominators.h"
 #include "llvm/IR/Function.h"
+#include "llvm/IR/GlobalValue.h"
 #include "llvm/IR/GlobalVariable.h"
 #include "llvm/IR/IRBuilder.h"
 #include "llvm/IR/InlineAsm.h"
 #include "llvm/IR/InstIterator.h"
+#include "llvm/IR/Instruction.h"
 #include "llvm/IR/Instructions.h"
 #include "llvm/IR/IntrinsicInst.h"
 #include "llvm/IR/Module.h"
+#include "llvm/IR/Type.h"
 #include "llvm/Pass.h"
+#include "llvm/Support/Casting.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/raw_ostream.h"
+#include <algorithm>
+#include <cassert>
+#include <utility>
 
 using namespace llvm;
 
@@ -56,6 +64,7 @@
 //===----------------------------------------------------------------------===//
 
 namespace {
+
 /// Promotes interesting constant into global variables.
 /// The motivating example is:
 /// static const uint16_t TableA[32] = {
@@ -83,13 +92,12 @@
 /// Therefore the final assembly final has 4 different loads. With this pass
 /// enabled, only one load is issued for the constants.
 class AArch64PromoteConstant : public ModulePass {
-
 public:
   struct PromotedConstant {
     bool ShouldConvert = false;
     GlobalVariable *GV = nullptr;
   };
-  typedef SmallDenseMap<Constant *, PromotedConstant, 16> PromotionCacheTy;
+  using PromotionCacheTy = SmallDenseMap<Constant *, PromotedConstant, 16>;
 
   struct UpdateRecord {
     Constant *C;
@@ -101,6 +109,7 @@
   };
 
   static char ID;
+
   AArch64PromoteConstant() : ModulePass(ID) {
     initializeAArch64PromoteConstantPass(*PassRegistry::getPassRegistry());
   }
@@ -135,9 +144,9 @@
   }
 
   /// Type to store a list of Uses.
-  typedef SmallVector<std::pair<Instruction *, unsigned>, 4> Uses;
+  using Uses = SmallVector<std::pair<Instruction *, unsigned>, 4>;
   /// Map an insertion point to all the uses it dominates.
-  typedef DenseMap<Instruction *, Uses> InsertionPoints;
+  using InsertionPoints = DenseMap<Instruction *, Uses>;
 
   /// Find the closest point that dominates the given Use.
   Instruction *findInsertionPoint(Instruction &User, unsigned OpNo);
@@ -212,6 +221,7 @@
     InsertPts.erase(OldInstr);
   }
 };
+
 } // end anonymous namespace
 
 char AArch64PromoteConstant::ID = 0;
@@ -357,7 +367,6 @@
 bool AArch64PromoteConstant::isDominated(Instruction *NewPt, Instruction *User,
                                          unsigned OpNo,
                                          InsertionPoints &InsertPts) {
-
   DominatorTree &DT = getAnalysis<DominatorTreeWrapperPass>(
       *NewPt->getParent()->getParent()).getDomTree();