[llvm] r292320 - [Target, Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

Eugene Zelenko via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 17 16:57:48 PST 2017


Author: eugenezelenko
Date: Tue Jan 17 18:57:48 2017
New Revision: 292320

URL: http://llvm.org/viewvc/llvm-project?rev=292320&view=rev
Log:
[Target, Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

Modified:
    llvm/trunk/include/llvm/Target/TargetCallingConv.h
    llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h
    llvm/trunk/include/llvm/Transforms/IPO/LowerTypeTests.h
    llvm/trunk/include/llvm/Transforms/InstrProfiling.h
    llvm/trunk/include/llvm/Transforms/Instrumentation.h
    llvm/trunk/include/llvm/Transforms/Scalar/GVNExpression.h
    llvm/trunk/include/llvm/Transforms/Scalar/LoopDataPrefetch.h
    llvm/trunk/include/llvm/Transforms/Scalar/LoopDeletion.h
    llvm/trunk/include/llvm/Transforms/Scalar/MemCpyOptimizer.h
    llvm/trunk/include/llvm/Transforms/Scalar/SROA.h
    llvm/trunk/include/llvm/Transforms/Utils/SSAUpdater.h
    llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp
    llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp
    llvm/trunk/lib/Transforms/Utils/SSAUpdater.cpp

Modified: llvm/trunk/include/llvm/Target/TargetCallingConv.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetCallingConv.h?rev=292320&r1=292319&r2=292320&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetCallingConv.h (original)
+++ llvm/trunk/include/llvm/Target/TargetCallingConv.h Tue Jan 17 18:57:48 2017
@@ -14,14 +14,16 @@
 #ifndef LLVM_TARGET_TARGETCALLINGCONV_H
 #define LLVM_TARGET_TARGETCALLINGCONV_H
 
+#include "llvm/CodeGen/MachineValueType.h"
 #include "llvm/CodeGen/ValueTypes.h"
-#include "llvm/Support/DataTypes.h"
 #include "llvm/Support/MathExtras.h"
+#include <cassert>
 #include <climits>
+#include <cstdint>
 
 namespace llvm {
-
 namespace ISD {
+
   struct ArgFlagsTy {
   private:
     static const uint64_t NoFlagSet      = 0ULL;
@@ -71,10 +73,10 @@ namespace ISD {
 
     static const uint64_t One            = 1ULL; ///< 1 of this type, for shifts
 
-    uint64_t Flags;
+    uint64_t Flags = 0;
 
   public:
-    ArgFlagsTy() : Flags(0) { }
+    ArgFlagsTy() = default;
 
     bool isZExt()      const { return Flags & ZExt; }
     void setZExt()     { Flags |= One << ZExtOffs; }
@@ -162,9 +164,9 @@ namespace ISD {
   ///
   struct InputArg {
     ArgFlagsTy Flags;
-    MVT VT;
+    MVT VT = MVT::Other;
     EVT ArgVT;
-    bool Used;
+    bool Used = false;
 
     /// Index original Function's argument.
     unsigned OrigArgIndex;
@@ -176,7 +178,7 @@ namespace ISD {
     /// registers, we got 4 InputArgs with PartOffsets 0, 4, 8 and 12.
     unsigned PartOffset;
 
-    InputArg() : VT(MVT::Other), Used(false) {}
+    InputArg() = default;
     InputArg(ArgFlagsTy flags, EVT vt, EVT argvt, bool used,
              unsigned origIdx, unsigned partOffs)
       : Flags(flags), Used(used), OrigArgIndex(origIdx), PartOffset(partOffs) {
@@ -204,7 +206,7 @@ namespace ISD {
     EVT ArgVT;
 
     /// IsFixed - Is this a "fixed" value, ie not passed through a vararg "...".
-    bool IsFixed;
+    bool IsFixed = false;
 
     /// Index original Function's argument.
     unsigned OrigArgIndex;
@@ -214,7 +216,7 @@ namespace ISD {
     /// registers, we got 4 OutputArgs with PartOffsets 0, 4, 8 and 12.
     unsigned PartOffset;
 
-    OutputArg() : IsFixed(false) {}
+    OutputArg() = default;
     OutputArg(ArgFlagsTy flags, EVT vt, EVT argvt, bool isfixed,
               unsigned origIdx, unsigned partOffs)
       : Flags(flags), IsFixed(isfixed), OrigArgIndex(origIdx),
@@ -223,8 +225,8 @@ namespace ISD {
       ArgVT = argvt;
     }
   };
-} // end namespace ISD
 
-} // end llvm namespace
+} // end namespace ISD
+} // end namespace llvm
 
 #endif // LLVM_TARGET_TARGETCALLINGCONV_H

Modified: llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h?rev=292320&r1=292319&r2=292320&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h (original)
+++ llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h Tue Jan 17 18:57:48 2017
@@ -16,37 +16,35 @@
 #define LLVM_TARGET_TARGETLOWERINGOBJECTFILE_H
 
 #include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/StringRef.h"
 #include "llvm/IR/Module.h"
 #include "llvm/MC/MCObjectFileInfo.h"
 #include "llvm/MC/SectionKind.h"
+#include <cstdint>
 
 namespace llvm {
-  class MachineModuleInfo;
-  class Mangler;
-  class MCContext;
-  class MCExpr;
-  class MCSection;
-  class MCSymbol;
-  class MCSymbolRefExpr;
-  class MCStreamer;
-  class MCValue;
-  class ConstantExpr;
-  class GlobalValue;
-  class TargetMachine;
+
+class GlobalValue;
+class MachineModuleInfo;
+class Mangler;
+class MCContext;
+class MCExpr;
+class MCSection;
+class MCSymbol;
+class MCSymbolRefExpr;
+class MCStreamer;
+class MCValue;
+class TargetMachine;
 
 class TargetLoweringObjectFile : public MCObjectFileInfo {
-  MCContext *Ctx;
+  MCContext *Ctx = nullptr;
 
   /// Name-mangler for global names.
   Mangler *Mang = nullptr;
 
-  TargetLoweringObjectFile(
-    const TargetLoweringObjectFile&) = delete;
-  void operator=(const TargetLoweringObjectFile&) = delete;
-
 protected:
-  bool SupportIndirectSymViaGOTPCRel;
-  bool SupportGOTPCRelWithOffset;
+  bool SupportIndirectSymViaGOTPCRel = false;
+  bool SupportGOTPCRelWithOffset = true;
 
   /// This section contains the static constructor pointer list.
   MCSection *StaticCtorSection;
@@ -55,15 +53,15 @@ protected:
   MCSection *StaticDtorSection;
 
 public:
+  TargetLoweringObjectFile() = default;
+  TargetLoweringObjectFile(const TargetLoweringObjectFile &) = delete;
+  TargetLoweringObjectFile &
+  operator=(const TargetLoweringObjectFile &) = delete;
+  virtual ~TargetLoweringObjectFile();
+
   MCContext &getContext() const { return *Ctx; }
   Mangler &getMangler() const { return *Mang; }
 
-  TargetLoweringObjectFile()
-      : MCObjectFileInfo(), Ctx(nullptr), Mang(nullptr),
-        SupportIndirectSymViaGOTPCRel(false), SupportGOTPCRelWithOffset(true) {}
-
-  virtual ~TargetLoweringObjectFile();
-
   /// This method must be called before any actual lowering is done.  This
   /// specifies the current context for codegen, and gives the lowering
   /// implementations a chance to set up their default sections.
@@ -194,4 +192,4 @@ protected:
 
 } // end namespace llvm
 
-#endif
+#endif // LLVM_TARGET_TARGETLOWERINGOBJECTFILE_H

Modified: llvm/trunk/include/llvm/Transforms/IPO/LowerTypeTests.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/IPO/LowerTypeTests.h?rev=292320&r1=292319&r2=292320&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/IPO/LowerTypeTests.h (original)
+++ llvm/trunk/include/llvm/Transforms/IPO/LowerTypeTests.h Tue Jan 17 18:57:48 2017
@@ -15,11 +15,9 @@
 #ifndef LLVM_TRANSFORMS_IPO_LOWERTYPETESTS_H
 #define LLVM_TRANSFORMS_IPO_LOWERTYPETESTS_H
 
-#include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/IR/Module.h"
 #include "llvm/IR/PassManager.h"
-
 #include <cstdint>
 #include <cstring>
 #include <limits>
@@ -28,9 +26,6 @@
 
 namespace llvm {
 
-class DataLayout;
-class GlobalObject;
-class Value;
 class raw_ostream;
 
 namespace lowertypetests {
@@ -65,9 +60,10 @@ struct BitSetInfo {
 
 struct BitSetBuilder {
   SmallVector<uint64_t, 16> Offsets;
-  uint64_t Min, Max;
+  uint64_t Min = std::numeric_limits<uint64_t>::max();
+  uint64_t Max = 0;
 
-  BitSetBuilder() : Min(std::numeric_limits<uint64_t>::max()), Max(0) {}
+  BitSetBuilder() = default;
 
   void addOffset(uint64_t Offset) {
     if (Min > Offset)

Modified: llvm/trunk/include/llvm/Transforms/InstrProfiling.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/InstrProfiling.h?rev=292320&r1=292319&r2=292320&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/InstrProfiling.h (original)
+++ llvm/trunk/include/llvm/Transforms/InstrProfiling.h Tue Jan 17 18:57:48 2017
@@ -1,4 +1,4 @@
-//===- Transforms/InstrProfiling.h - Instrumentation passes ---*- C++ -*-===//
+//===- Transforms/InstrProfiling.h - Instrumentation passes -----*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -14,10 +14,16 @@
 #ifndef LLVM_TRANSFORMS_INSTRPROFILING_H
 #define LLVM_TRANSFORMS_INSTRPROFILING_H
 
+#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/StringRef.h"
 #include "llvm/IR/IntrinsicInst.h"
 #include "llvm/IR/PassManager.h"
 #include "llvm/ProfileData/InstrProf.h"
 #include "llvm/Transforms/Instrumentation.h"
+#include <cstddef>
+#include <cstdint>
+#include <cstring>
+#include <vector>
 
 namespace llvm {
 
@@ -28,7 +34,7 @@ class TargetLibraryInfo;
 /// instrumentation pass.
 class InstrProfiling : public PassInfoMixin<InstrProfiling> {
 public:
-  InstrProfiling() {}
+  InstrProfiling() = default;
   InstrProfiling(const InstrProfOptions &Options) : Options(Options) {}
 
   PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
@@ -40,9 +46,10 @@ private:
   const TargetLibraryInfo *TLI;
   struct PerFunctionProfileData {
     uint32_t NumValueSites[IPVK_Last + 1];
-    GlobalVariable *RegionCounters;
-    GlobalVariable *DataVar;
-    PerFunctionProfileData() : RegionCounters(nullptr), DataVar(nullptr) {
+    GlobalVariable *RegionCounters = nullptr;
+    GlobalVariable *DataVar = nullptr;
+
+    PerFunctionProfileData() {
       memset(NumValueSites, 0, sizeof(uint32_t) * (IPVK_Last + 1));
     }
   };
@@ -104,5 +111,6 @@ private:
   void emitInitialization();
 };
 
-} // End llvm namespace
-#endif
+} // end namespace llvm
+
+#endif // LLVM_TRANSFORMS_INSTRPROFILING_H

Modified: llvm/trunk/include/llvm/Transforms/Instrumentation.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Instrumentation.h?rev=292320&r1=292319&r2=292320&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Instrumentation.h (original)
+++ llvm/trunk/include/llvm/Transforms/Instrumentation.h Tue Jan 17 18:57:48 2017
@@ -16,6 +16,10 @@
 
 #include "llvm/ADT/StringRef.h"
 #include "llvm/IR/BasicBlock.h"
+#include <cassert>
+#include <cstdint>
+#include <limits>
+#include <string>
 #include <vector>
 
 #if defined(__GNUC__) && defined(__linux__) && !defined(ANDROID)
@@ -34,7 +38,8 @@ inline void *getDFSanRetValTLSPtrForJIT(
 
 namespace llvm {
 
-class TargetMachine;
+class FunctionPass;
+class ModulePass;
 
 /// Instrumentation passes often insert conditional checks into entry blocks.
 /// Call this function before splitting the entry block to move instructions
@@ -44,9 +49,6 @@ class TargetMachine;
 BasicBlock::iterator PrepareToSplitEntryBlock(BasicBlock &BB,
                                               BasicBlock::iterator IP);
 
-class ModulePass;
-class FunctionPass;
-
 // Insert GCOV profiling instrumentation
 struct GCOVOptions {
   static GCOVOptions getDefault();
@@ -76,6 +78,7 @@ struct GCOVOptions {
   // all of the function body's blocks.
   bool ExitBlockBeforeBody;
 };
+
 ModulePass *createGCOVProfilerPass(const GCOVOptions &Options =
                                    GCOVOptions::getDefault());
 
@@ -87,13 +90,13 @@ ModulePass *createPGOIndirectCallPromoti
 
 /// Options for the frontend instrumentation based profiling pass.
 struct InstrProfOptions {
-  InstrProfOptions() : NoRedZone(false) {}
-
   // Add the 'noredzone' attribute to added runtime library calls.
-  bool NoRedZone;
+  bool NoRedZone = false;
 
   // Name of the profile file to use as output
   std::string InstrProfileOutput;
+
+  InstrProfOptions() = default;
 };
 
 /// Insert frontend instrumentation based profiling.
@@ -121,12 +124,13 @@ ModulePass *createDataFlowSanitizerPass(
 
 // Options for EfficiencySanitizer sub-tools.
 struct EfficiencySanitizerOptions {
-  EfficiencySanitizerOptions() : ToolType(ESAN_None) {}
   enum Type {
     ESAN_None = 0,
     ESAN_CacheFrag,
     ESAN_WorkingSet,
-  } ToolType;
+  } ToolType = ESAN_None;
+
+  EfficiencySanitizerOptions() = default;
 };
 
 // Insert EfficiencySanitizer instrumentation.
@@ -135,25 +139,22 @@ ModulePass *createEfficiencySanitizerPas
 
 // Options for sanitizer coverage instrumentation.
 struct SanitizerCoverageOptions {
-  SanitizerCoverageOptions()
-      : CoverageType(SCK_None), IndirectCalls(false), TraceBB(false),
-        TraceCmp(false), TraceDiv(false), TraceGep(false),
-        Use8bitCounters(false), TracePC(false), TracePCGuard(false) {}
-
   enum Type {
     SCK_None = 0,
     SCK_Function,
     SCK_BB,
     SCK_Edge
-  } CoverageType;
-  bool IndirectCalls;
-  bool TraceBB;
-  bool TraceCmp;
-  bool TraceDiv;
-  bool TraceGep;
-  bool Use8bitCounters;
-  bool TracePC;
-  bool TracePCGuard;
+  } CoverageType = SCK_None;
+  bool IndirectCalls = false;
+  bool TraceBB = false;
+  bool TraceCmp = false;
+  bool TraceDiv = false;
+  bool TraceGep = false;
+  bool Use8bitCounters = false;
+  bool TracePC = false;
+  bool TracePCGuard = false;
+
+  SanitizerCoverageOptions() = default;
 };
 
 // Insert SanitizerCoverage instrumentation.
@@ -175,9 +176,11 @@ FunctionPass *createBoundsCheckingPass()
 /// \brief Calculate what to divide by to scale counts.
 ///
 /// Given the maximum count, calculate a divisor that will scale all the
-/// weights to strictly less than UINT32_MAX.
+/// weights to strictly less than std::numeric_limits<uint32_t>::max().
 static inline uint64_t calculateCountScale(uint64_t MaxCount) {
-  return MaxCount < UINT32_MAX ? 1 : MaxCount / UINT32_MAX + 1;
+  return MaxCount < std::numeric_limits<uint32_t>::max()
+             ? 1
+             : MaxCount / std::numeric_limits<uint32_t>::max() + 1;
 }
 
 /// \brief Scale an individual branch count.
@@ -186,10 +189,10 @@ static inline uint64_t calculateCountSca
 ///
 static inline uint32_t scaleBranchCount(uint64_t Count, uint64_t Scale) {
   uint64_t Scaled = Count / Scale;
-  assert(Scaled <= UINT32_MAX && "overflow 32-bits");
+  assert(Scaled <= std::numeric_limits<uint32_t>::max() && "overflow 32-bits");
   return Scaled;
 }
 
-} // End llvm namespace
+} // end namespace llvm
 
-#endif
+#endif // LLVM_TRANSFORMS_INSTRUMENTATION_H

Modified: llvm/trunk/include/llvm/Transforms/Scalar/GVNExpression.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Scalar/GVNExpression.h?rev=292320&r1=292319&r2=292320&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Scalar/GVNExpression.h (original)
+++ llvm/trunk/include/llvm/Transforms/Scalar/GVNExpression.h Tue Jan 17 18:57:48 2017
@@ -1,4 +1,4 @@
-//======- GVNExpression.h - GVN Expression classes -------*- C++ -*-==-------=//
+//======- GVNExpression.h - GVN Expression classes --------------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -17,18 +17,22 @@
 #define LLVM_TRANSFORMS_SCALAR_GVNEXPRESSION_H
 
 #include "llvm/ADT/Hashing.h"
+#include "llvm/ADT/iterator_range.h"
 #include "llvm/IR/Constant.h"
 #include "llvm/IR/Instructions.h"
 #include "llvm/IR/Value.h"
 #include "llvm/Support/Allocator.h"
 #include "llvm/Support/ArrayRecycler.h"
+#include "llvm/Support/Casting.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Transforms/Utils/MemorySSA.h"
 #include <algorithm>
+#include <cassert>
+#include <iterator>
+#include <utility>
 
 namespace llvm {
-class MemoryAccess;
 
 namespace GVNExpression {
 
@@ -53,10 +57,10 @@ private:
   unsigned Opcode;
 
 public:
-  Expression(const Expression &) = delete;
   Expression(ExpressionType ET = ET_Base, unsigned O = ~2U)
       : EType(ET), Opcode(O) {}
-  void operator=(const Expression &) = delete;
+  Expression(const Expression &) = delete;
+  Expression &operator=(const Expression &) = delete;
   virtual ~Expression();
 
   static unsigned getEmptyKey() { return ~0U; }
@@ -101,6 +105,7 @@ public:
     printInternal(OS, true);
     OS << "}";
   }
+
   void dump() const { print(dbgs()); }
 };
 
@@ -119,20 +124,20 @@ private:
   Type *ValueType;
 
 public:
-  static bool classof(const Expression *EB) {
-    ExpressionType ET = EB->getExpressionType();
-    return ET > ET_BasicStart && ET < ET_BasicEnd;
-  }
-
   BasicExpression(unsigned NumOperands)
       : BasicExpression(NumOperands, ET_Basic) {}
   BasicExpression(unsigned NumOperands, ExpressionType ET)
       : Expression(ET), Operands(nullptr), MaxOperands(NumOperands),
         NumOperands(0), ValueType(nullptr) {}
-  virtual ~BasicExpression() override;
-  void operator=(const BasicExpression &) = delete;
-  BasicExpression(const BasicExpression &) = delete;
   BasicExpression() = delete;
+  BasicExpression(const BasicExpression &) = delete;
+  BasicExpression &operator=(const BasicExpression &) = delete;
+  ~BasicExpression() override;
+
+  static bool classof(const Expression *EB) {
+    ExpressionType ET = EB->getExpressionType();
+    return ET > ET_BasicStart && ET < ET_BasicEnd;
+  }
 
   /// \brief Swap two operands. Used during GVN to put commutative operands in
   /// order.
@@ -185,7 +190,7 @@ public:
   void setType(Type *T) { ValueType = T; }
   Type *getType() const { return ValueType; }
 
-  virtual bool equals(const Expression &Other) const override {
+  bool equals(const Expression &Other) const override {
     if (getOpcode() != Other.getOpcode())
       return false;
 
@@ -194,7 +199,7 @@ public:
            std::equal(op_begin(), op_end(), OE.op_begin());
   }
 
-  virtual hash_code getHashValue() const override {
+  hash_code getHashValue() const override {
     return hash_combine(getExpressionType(), getOpcode(), ValueType,
                         hash_combine_range(op_begin(), op_end()));
   }
@@ -202,7 +207,7 @@ public:
   //
   // Debugging support
   //
-  virtual void printInternal(raw_ostream &OS, bool PrintEType) const override {
+  void printInternal(raw_ostream &OS, bool PrintEType) const override {
     if (PrintEType)
       OS << "ExpressionTypeBasic, ";
 
@@ -216,6 +221,7 @@ public:
     OS << "} ";
   }
 };
+
 class op_inserter
     : public std::iterator<std::output_iterator_tag, void, void, void, void> {
 private:
@@ -241,32 +247,32 @@ private:
   MemoryAccess *DefiningAccess;
 
 public:
-  static bool classof(const Expression *EB) {
-    return EB->getExpressionType() == ET_Call;
-  }
-
   CallExpression(unsigned NumOperands, CallInst *C, MemoryAccess *DA)
       : BasicExpression(NumOperands, ET_Call), Call(C), DefiningAccess(DA) {}
-  void operator=(const CallExpression &) = delete;
-  CallExpression(const CallExpression &) = delete;
   CallExpression() = delete;
-  virtual ~CallExpression() override;
+  CallExpression(const CallExpression &) = delete;
+  CallExpression &operator=(const CallExpression &) = delete;
+  ~CallExpression() override;
+
+  static bool classof(const Expression *EB) {
+    return EB->getExpressionType() == ET_Call;
+  }
 
-  virtual bool equals(const Expression &Other) const override {
+  bool equals(const Expression &Other) const override {
     if (!this->BasicExpression::equals(Other))
       return false;
     const auto &OE = cast<CallExpression>(Other);
     return DefiningAccess == OE.DefiningAccess;
   }
 
-  virtual hash_code getHashValue() const override {
+  hash_code getHashValue() const override {
     return hash_combine(this->BasicExpression::getHashValue(), DefiningAccess);
   }
 
   //
   // Debugging support
   //
-  virtual void printInternal(raw_ostream &OS, bool PrintEType) const override {
+  void printInternal(raw_ostream &OS, bool PrintEType) const override {
     if (PrintEType)
       OS << "ExpressionTypeCall, ";
     this->BasicExpression::printInternal(OS, false);
@@ -281,10 +287,6 @@ private:
   unsigned Alignment;
 
 public:
-  static bool classof(const Expression *EB) {
-    return EB->getExpressionType() == ET_Load;
-  }
-
   LoadExpression(unsigned NumOperands, LoadInst *L, MemoryAccess *DA)
       : LoadExpression(ET_Load, NumOperands, L, DA) {}
   LoadExpression(enum ExpressionType EType, unsigned NumOperands, LoadInst *L,
@@ -292,10 +294,14 @@ public:
       : BasicExpression(NumOperands, EType), Load(L), DefiningAccess(DA) {
     Alignment = L ? L->getAlignment() : 0;
   }
-  void operator=(const LoadExpression &) = delete;
-  LoadExpression(const LoadExpression &) = delete;
   LoadExpression() = delete;
-  virtual ~LoadExpression() override;
+  LoadExpression(const LoadExpression &) = delete;
+  LoadExpression &operator=(const LoadExpression &) = delete;
+  ~LoadExpression() override;
+
+  static bool classof(const Expression *EB) {
+    return EB->getExpressionType() == ET_Load;
+  }
 
   LoadInst *getLoadInst() const { return Load; }
   void setLoadInst(LoadInst *L) { Load = L; }
@@ -305,9 +311,9 @@ public:
   unsigned getAlignment() const { return Alignment; }
   void setAlignment(unsigned Align) { Alignment = Align; }
 
-  virtual bool equals(const Expression &Other) const override;
+  bool equals(const Expression &Other) const override;
 
-  virtual hash_code getHashValue() const override {
+  hash_code getHashValue() const override {
     return hash_combine(getOpcode(), getType(), DefiningAccess,
                         hash_combine_range(op_begin(), op_end()));
   }
@@ -315,7 +321,7 @@ public:
   //
   // Debugging support
   //
-  virtual void printInternal(raw_ostream &OS, bool PrintEType) const override {
+  void printInternal(raw_ostream &OS, bool PrintEType) const override {
     if (PrintEType)
       OS << "ExpressionTypeLoad, ";
     this->BasicExpression::printInternal(OS, false);
@@ -330,23 +336,23 @@ private:
   MemoryAccess *DefiningAccess;
 
 public:
-  static bool classof(const Expression *EB) {
-    return EB->getExpressionType() == ET_Store;
-  }
-
   StoreExpression(unsigned NumOperands, StoreInst *S, MemoryAccess *DA)
       : BasicExpression(NumOperands, ET_Store), Store(S), DefiningAccess(DA) {}
-  void operator=(const StoreExpression &) = delete;
-  StoreExpression(const StoreExpression &) = delete;
   StoreExpression() = delete;
-  virtual ~StoreExpression() override;
+  StoreExpression(const StoreExpression &) = delete;
+  StoreExpression &operator=(const StoreExpression &) = delete;
+  ~StoreExpression() override;
+
+  static bool classof(const Expression *EB) {
+    return EB->getExpressionType() == ET_Store;
+  }
 
   StoreInst *getStoreInst() const { return Store; }
   MemoryAccess *getDefiningAccess() const { return DefiningAccess; }
 
-  virtual bool equals(const Expression &Other) const override;
+  bool equals(const Expression &Other) const override;
 
-  virtual hash_code getHashValue() const override {
+  hash_code getHashValue() const override {
     return hash_combine(getOpcode(), getType(), DefiningAccess,
                         hash_combine_range(op_begin(), op_end()));
   }
@@ -354,7 +360,7 @@ public:
   //
   // Debugging support
   //
-  virtual void printInternal(raw_ostream &OS, bool PrintEType) const override {
+  void printInternal(raw_ostream &OS, bool PrintEType) const override {
     if (PrintEType)
       OS << "ExpressionTypeStore, ";
     this->BasicExpression::printInternal(OS, false);
@@ -370,19 +376,19 @@ private:
   unsigned *IntOperands;
 
 public:
-  static bool classof(const Expression *EB) {
-    return EB->getExpressionType() == ET_AggregateValue;
-  }
-
   AggregateValueExpression(unsigned NumOperands, unsigned NumIntOperands)
       : BasicExpression(NumOperands, ET_AggregateValue),
         MaxIntOperands(NumIntOperands), NumIntOperands(0),
         IntOperands(nullptr) {}
-
-  void operator=(const AggregateValueExpression &) = delete;
-  AggregateValueExpression(const AggregateValueExpression &) = delete;
   AggregateValueExpression() = delete;
-  virtual ~AggregateValueExpression() override;
+  AggregateValueExpression(const AggregateValueExpression &) = delete;
+  AggregateValueExpression &
+  operator=(const AggregateValueExpression &) = delete;
+  ~AggregateValueExpression() override;
+
+  static bool classof(const Expression *EB) {
+    return EB->getExpressionType() == ET_AggregateValue;
+  }
 
   typedef unsigned *int_arg_iterator;
   typedef const unsigned *const_int_arg_iterator;
@@ -407,7 +413,7 @@ public:
     IntOperands = Allocator.Allocate<unsigned>(MaxIntOperands);
   }
 
-  virtual bool equals(const Expression &Other) const override {
+  bool equals(const Expression &Other) const override {
     if (!this->BasicExpression::equals(Other))
       return false;
     const AggregateValueExpression &OE = cast<AggregateValueExpression>(Other);
@@ -415,7 +421,7 @@ public:
            std::equal(int_op_begin(), int_op_end(), OE.int_op_begin());
   }
 
-  virtual hash_code getHashValue() const override {
+  hash_code getHashValue() const override {
     return hash_combine(this->BasicExpression::getHashValue(),
                         hash_combine_range(int_op_begin(), int_op_end()));
   }
@@ -423,7 +429,7 @@ public:
   //
   // Debugging support
   //
-  virtual void printInternal(raw_ostream &OS, bool PrintEType) const override {
+  void printInternal(raw_ostream &OS, bool PrintEType) const override {
     if (PrintEType)
       OS << "ExpressionTypeAggregateValue, ";
     this->BasicExpression::printInternal(OS, false);
@@ -434,6 +440,7 @@ public:
     OS << "}";
   }
 };
+
 class int_op_inserter
     : public std::iterator<std::output_iterator_tag, void, void, void, void> {
 private:
@@ -443,6 +450,7 @@ private:
 public:
   explicit int_op_inserter(AggregateValueExpression &E) : AVE(&E) {}
   explicit int_op_inserter(AggregateValueExpression *E) : AVE(E) {}
+
   int_op_inserter &operator=(unsigned int val) {
     AVE->int_op_push_back(val);
     return *this;
@@ -457,32 +465,32 @@ private:
   BasicBlock *BB;
 
 public:
-  static bool classof(const Expression *EB) {
-    return EB->getExpressionType() == ET_Phi;
-  }
-
   PHIExpression(unsigned NumOperands, BasicBlock *B)
       : BasicExpression(NumOperands, ET_Phi), BB(B) {}
-  void operator=(const PHIExpression &) = delete;
-  PHIExpression(const PHIExpression &) = delete;
   PHIExpression() = delete;
-  virtual ~PHIExpression() override;
+  PHIExpression(const PHIExpression &) = delete;
+  PHIExpression &operator=(const PHIExpression &) = delete;
+  ~PHIExpression() override;
+
+  static bool classof(const Expression *EB) {
+    return EB->getExpressionType() == ET_Phi;
+  }
 
-  virtual bool equals(const Expression &Other) const override {
+  bool equals(const Expression &Other) const override {
     if (!this->BasicExpression::equals(Other))
       return false;
     const PHIExpression &OE = cast<PHIExpression>(Other);
     return BB == OE.BB;
   }
 
-  virtual hash_code getHashValue() const override {
+  hash_code getHashValue() const override {
     return hash_combine(this->BasicExpression::getHashValue(), BB);
   }
 
   //
   // Debugging support
   //
-  virtual void printInternal(raw_ostream &OS, bool PrintEType) const override {
+  void printInternal(raw_ostream &OS, bool PrintEType) const override {
     if (PrintEType)
       OS << "ExpressionTypePhi, ";
     this->BasicExpression::printInternal(OS, false);
@@ -495,23 +503,24 @@ private:
   Value *VariableValue;
 
 public:
+  VariableExpression(Value *V) : Expression(ET_Variable), VariableValue(V) {}
+  VariableExpression() = delete;
+  VariableExpression(const VariableExpression &) = delete;
+  VariableExpression &operator=(const VariableExpression &) = delete;
+
   static bool classof(const Expression *EB) {
     return EB->getExpressionType() == ET_Variable;
   }
 
-  VariableExpression(Value *V) : Expression(ET_Variable), VariableValue(V) {}
-  void operator=(const VariableExpression &) = delete;
-  VariableExpression(const VariableExpression &) = delete;
-  VariableExpression() = delete;
-
   Value *getVariableValue() const { return VariableValue; }
   void setVariableValue(Value *V) { VariableValue = V; }
-  virtual bool equals(const Expression &Other) const override {
+
+  bool equals(const Expression &Other) const override {
     const VariableExpression &OC = cast<VariableExpression>(Other);
     return VariableValue == OC.VariableValue;
   }
 
-  virtual hash_code getHashValue() const override {
+  hash_code getHashValue() const override {
     return hash_combine(getExpressionType(), VariableValue->getType(),
                         VariableValue);
   }
@@ -519,7 +528,7 @@ public:
   //
   // Debugging support
   //
-  virtual void printInternal(raw_ostream &OS, bool PrintEType) const override {
+  void printInternal(raw_ostream &OS, bool PrintEType) const override {
     if (PrintEType)
       OS << "ExpressionTypeVariable, ";
     this->Expression::printInternal(OS, false);
@@ -529,28 +538,28 @@ public:
 
 class ConstantExpression final : public Expression {
 private:
-  Constant *ConstantValue;
+  Constant *ConstantValue = nullptr;
 
 public:
-  static bool classof(const Expression *EB) {
-    return EB->getExpressionType() == ET_Constant;
-  }
-
-  ConstantExpression() : Expression(ET_Constant), ConstantValue(NULL) {}
+  ConstantExpression() : Expression(ET_Constant) {}
   ConstantExpression(Constant *constantValue)
       : Expression(ET_Constant), ConstantValue(constantValue) {}
-  void operator=(const ConstantExpression &) = delete;
   ConstantExpression(const ConstantExpression &) = delete;
+  ConstantExpression &operator=(const ConstantExpression &) = delete;
+
+  static bool classof(const Expression *EB) {
+    return EB->getExpressionType() == ET_Constant;
+  }
 
   Constant *getConstantValue() const { return ConstantValue; }
   void setConstantValue(Constant *V) { ConstantValue = V; }
 
-  virtual bool equals(const Expression &Other) const override {
+  bool equals(const Expression &Other) const override {
     const ConstantExpression &OC = cast<ConstantExpression>(Other);
     return ConstantValue == OC.ConstantValue;
   }
 
-  virtual hash_code getHashValue() const override {
+  hash_code getHashValue() const override {
     return hash_combine(getExpressionType(), ConstantValue->getType(),
                         ConstantValue);
   }
@@ -558,7 +567,7 @@ public:
   //
   // Debugging support
   //
-  virtual void printInternal(raw_ostream &OS, bool PrintEType) const override {
+  void printInternal(raw_ostream &OS, bool PrintEType) const override {
     if (PrintEType)
       OS << "ExpressionTypeConstant, ";
     this->Expression::printInternal(OS, false);
@@ -571,35 +580,40 @@ private:
   Instruction *Inst;
 
 public:
+  UnknownExpression(Instruction *I) : Expression(ET_Unknown), Inst(I) {}
+  UnknownExpression() = delete;
+  UnknownExpression(const UnknownExpression &) = delete;
+  UnknownExpression &operator=(const UnknownExpression &) = delete;
+
   static bool classof(const Expression *EB) {
     return EB->getExpressionType() == ET_Unknown;
   }
 
-  UnknownExpression(Instruction *I) : Expression(ET_Unknown), Inst(I) {}
-  void operator=(const UnknownExpression &) = delete;
-  UnknownExpression(const UnknownExpression &) = delete;
-  UnknownExpression() = delete;
-
   Instruction *getInstruction() const { return Inst; }
   void setInstruction(Instruction *I) { Inst = I; }
-  virtual bool equals(const Expression &Other) const override {
+
+  bool equals(const Expression &Other) const override {
     const auto &OU = cast<UnknownExpression>(Other);
     return Inst == OU.Inst;
   }
-  virtual hash_code getHashValue() const override {
+
+  hash_code getHashValue() const override {
     return hash_combine(getExpressionType(), Inst);
   }
+
   //
   // Debugging support
   //
-  virtual void printInternal(raw_ostream &OS, bool PrintEType) const override {
+  void printInternal(raw_ostream &OS, bool PrintEType) const override {
     if (PrintEType)
       OS << "ExpressionTypeUnknown, ";
     this->Expression::printInternal(OS, false);
     OS << " inst = " << *Inst;
   }
 };
-}
-}
 
-#endif
+} // end namespace GVNExpression
+
+} // end namespace llvm
+
+#endif // LLVM_TRANSFORMS_SCALAR_GVNEXPRESSION_H

Modified: llvm/trunk/include/llvm/Transforms/Scalar/LoopDataPrefetch.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Scalar/LoopDataPrefetch.h?rev=292320&r1=292319&r2=292320&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Scalar/LoopDataPrefetch.h (original)
+++ llvm/trunk/include/llvm/Transforms/Scalar/LoopDataPrefetch.h Tue Jan 17 18:57:48 2017
@@ -22,10 +22,12 @@ namespace llvm {
 /// An optimization pass inserting data prefetches in loops.
 class LoopDataPrefetchPass : public PassInfoMixin<LoopDataPrefetchPass> {
 public:
-  LoopDataPrefetchPass() {}
+  LoopDataPrefetchPass() = default;
+
   /// \brief Run the pass over the function.
   PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
-}
 
-#endif
+} // end namespace llvm
+
+#endif // LLVM_TRANSFORMS_SCALAR_LOOPDATAPREFETCH_H

Modified: llvm/trunk/include/llvm/Transforms/Scalar/LoopDeletion.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Scalar/LoopDeletion.h?rev=292320&r1=292319&r2=292320&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Scalar/LoopDeletion.h (original)
+++ llvm/trunk/include/llvm/Transforms/Scalar/LoopDeletion.h Tue Jan 17 18:57:48 2017
@@ -1,4 +1,4 @@
-//===- LoopDeletion.h - Loop Deletion -------------------------------------===//
+//===- LoopDeletion.h - Loop Deletion ---------------------------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -14,6 +14,7 @@
 #ifndef LLVM_TRANSFORMS_SCALAR_LOOPDELETION_H
 #define LLVM_TRANSFORMS_SCALAR_LOOPDELETION_H
 
+#include "llvm/Analysis/LoopAnalysisManager.h"
 #include "llvm/Analysis/LoopInfo.h"
 #include "llvm/Analysis/ScalarEvolution.h"
 #include "llvm/IR/PassManager.h"
@@ -23,10 +24,12 @@ namespace llvm {
 
 class LoopDeletionPass : public PassInfoMixin<LoopDeletionPass> {
 public:
-  LoopDeletionPass() {}
+  LoopDeletionPass() = default;
+
   PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
                         LoopStandardAnalysisResults &AR, LPMUpdater &U);
 };
-}
+
+} // end namespace llvm
 
 #endif // LLVM_TRANSFORMS_SCALAR_LOOPDELETION_H

Modified: llvm/trunk/include/llvm/Transforms/Scalar/MemCpyOptimizer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Scalar/MemCpyOptimizer.h?rev=292320&r1=292319&r2=292320&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Scalar/MemCpyOptimizer.h (original)
+++ llvm/trunk/include/llvm/Transforms/Scalar/MemCpyOptimizer.h Tue Jan 17 18:57:48 2017
@@ -15,17 +15,18 @@
 #ifndef LLVM_TRANSFORMS_SCALAR_MEMCPYOPTIMIZER_H
 #define LLVM_TRANSFORMS_SCALAR_MEMCPYOPTIMIZER_H
 
-#include "llvm/ADT/STLExtras.h"
 #include "llvm/Analysis/AliasAnalysis.h"
 #include "llvm/Analysis/AssumptionCache.h"
-#include "llvm/Analysis/GlobalsModRef.h"
 #include "llvm/Analysis/MemoryDependenceAnalysis.h"
 #include "llvm/Analysis/TargetLibraryInfo.h"
+#include "llvm/IR/BasicBlock.h"
 #include "llvm/IR/Dominators.h"
 #include "llvm/IR/Function.h"
 #include "llvm/IR/Instructions.h"
 #include "llvm/IR/IntrinsicInst.h"
 #include "llvm/IR/PassManager.h"
+#include <cstdint>
+#include <functional>
 
 namespace llvm {
 
@@ -37,7 +38,8 @@ class MemCpyOptPass : public PassInfoMix
   std::function<DominatorTree &()> LookupDomTree;
 
 public:
-  MemCpyOptPass() {}
+  MemCpyOptPass() = default;
+
   PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
   // Glue for the old PM.
   bool runImpl(Function &F, MemoryDependenceResults *MD_,
@@ -63,6 +65,7 @@ private:
 
   bool iterateOnFunction(Function &F);
 };
-}
+
+} // end namespace llvm
 
 #endif // LLVM_TRANSFORMS_SCALAR_MEMCPYOPTIMIZER_H

Modified: llvm/trunk/include/llvm/Transforms/Scalar/SROA.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Scalar/SROA.h?rev=292320&r1=292319&r2=292320&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Scalar/SROA.h (original)
+++ llvm/trunk/include/llvm/Transforms/Scalar/SROA.h Tue Jan 17 18:57:48 2017
@@ -21,17 +21,21 @@
 #include "llvm/IR/Dominators.h"
 #include "llvm/IR/Function.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
+#include <vector>
 
 namespace llvm {
 
 /// A private "module" namespace for types and utilities used by SROA. These
 /// are implementation details and should not be used by clients.
 namespace sroa LLVM_LIBRARY_VISIBILITY {
+
 class AllocaSliceRewriter;
 class AllocaSlices;
 class Partition;
 class SROALegacyPass;
-}
+
+} // end namespace sroa
 
 /// \brief An optimization pass providing Scalar Replacement of Aggregates.
 ///
@@ -52,9 +56,9 @@ class SROALegacyPass;
 ///    this form. By doing so, it will enable promotion of vector aggregates to
 ///    SSA vector values.
 class SROA : public PassInfoMixin<SROA> {
-  LLVMContext *C;
-  DominatorTree *DT;
-  AssumptionCache *AC;
+  LLVMContext *C = nullptr;
+  DominatorTree *DT = nullptr;
+  AssumptionCache *AC = nullptr;
 
   /// \brief Worklist of alloca instructions to simplify.
   ///
@@ -99,7 +103,7 @@ class SROA : public PassInfoMixin<SROA>
   SetVector<SelectInst *, SmallVector<SelectInst *, 2>> SpeculatableSelects;
 
 public:
-  SROA() : C(nullptr), DT(nullptr), AC(nullptr) {}
+  SROA() = default;
 
   /// \brief Run the pass over the function.
   PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
@@ -122,6 +126,6 @@ private:
   bool promoteAllocas(Function &F);
 };
 
-}
+} // end namespace llvm
 
-#endif
+#endif // LLVM_TRANSFORMS_SCALAR_SROA_H

Modified: llvm/trunk/include/llvm/Transforms/Utils/SSAUpdater.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Utils/SSAUpdater.h?rev=292320&r1=292319&r2=292320&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Utils/SSAUpdater.h (original)
+++ llvm/trunk/include/llvm/Transforms/Utils/SSAUpdater.h Tue Jan 17 18:57:48 2017
@@ -43,10 +43,10 @@ private:
   /// This keeps track of which value to use on a per-block basis. When we
   /// insert PHI nodes, we keep track of them here.
   //typedef DenseMap<BasicBlock*, Value*> AvailableValsTy;
-  void *AV;
+  void *AV = nullptr;
 
   /// ProtoType holds the type of the values being rewritten.
-  Type *ProtoType;
+  Type *ProtoType = nullptr;
 
   /// PHI nodes are given a name based on ProtoName.
   std::string ProtoName;

Modified: llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp?rev=292320&r1=292319&r2=292320&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp Tue Jan 17 18:57:48 2017
@@ -14,13 +14,38 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Transforms/InstrProfiling.h"
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/Triple.h"
+#include "llvm/ADT/Twine.h"
 #include "llvm/Analysis/TargetLibraryInfo.h"
-#include "llvm/IR/IRBuilder.h"
+#include "llvm/IR/Attributes.h"
+#include "llvm/IR/BasicBlock.h"
+#include "llvm/IR/Constant.h"
+#include "llvm/IR/Constants.h"
+#include "llvm/IR/DerivedTypes.h"
+#include "llvm/IR/Function.h"
+#include "llvm/IR/GlobalValue.h"
+#include "llvm/IR/GlobalVariable.h"
+#include "llvm/IR/Instruction.h"
+#include "llvm/IR/Instructions.h"
 #include "llvm/IR/IntrinsicInst.h"
+#include "llvm/IR/IRBuilder.h"
 #include "llvm/IR/Module.h"
+#include "llvm/IR/Type.h"
+#include "llvm/Pass.h"
 #include "llvm/ProfileData/InstrProf.h"
+#include "llvm/Support/Casting.h"
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Error.h"
+#include "llvm/Support/ErrorHandling.h"
 #include "llvm/Transforms/Utils/ModuleUtils.h"
+#include <algorithm>
+#include <cassert>
+#include <cstddef>
+#include <cstdint>
+#include <string>
 
 using namespace llvm;
 
@@ -41,6 +66,7 @@ cl::opt<bool> ValueProfileStaticAlloc(
     "vp-static-alloc",
     cl::desc("Do static counter allocation for value profiler"),
     cl::init(true));
+
 cl::opt<double> NumCountersPerValueSite(
     "vp-counters-per-site",
     cl::desc("The average number of profile counters allocated "
@@ -56,9 +82,11 @@ class InstrProfilingLegacyPass : public
 
 public:
   static char ID;
-  InstrProfilingLegacyPass() : ModulePass(ID), InstrProf() {}
+
+  InstrProfilingLegacyPass() : ModulePass(ID) {}
   InstrProfilingLegacyPass(const InstrProfOptions &Options)
       : ModulePass(ID), InstrProf(Options) {}
+
   StringRef getPassName() const override {
     return "Frontend instrumentation-based coverage lowering";
   }
@@ -73,7 +101,7 @@ public:
   }
 };
 
-} // anonymous namespace
+} // end anonymous namespace
 
 PreservedAnalyses InstrProfiling::run(Module &M, ModuleAnalysisManager &AM) {
   auto &TLI = AM.getResult<TargetLibraryAnalysis>(M);
@@ -208,7 +236,6 @@ static Constant *getOrInsertValueProfili
 }
 
 void InstrProfiling::computeNumValueSiteCounts(InstrProfValueProfileInst *Ind) {
-
   GlobalVariable *Name = Ind->getName();
   uint64_t ValueKind = Ind->getValueKind()->getZExtValue();
   uint64_t Index = Ind->getIndex()->getZExtValue();
@@ -222,7 +249,6 @@ void InstrProfiling::computeNumValueSite
 }
 
 void InstrProfiling::lowerValueProfileInst(InstrProfValueProfileInst *Ind) {
-
   GlobalVariable *Name = Ind->getName();
   auto It = ProfileDataMap.find(Name);
   assert(It != ProfileDataMap.end() && It->second.DataVar &&
@@ -259,7 +285,6 @@ void InstrProfiling::lowerIncrement(Inst
 }
 
 void InstrProfiling::lowerCoverageData(GlobalVariable *CoverageNamesVar) {
-
   ConstantArray *Names =
       cast<ConstantArray>(CoverageNamesVar->getInitializer());
   for (unsigned I = 0, E = Names->getNumOperands(); I < E; ++I) {
@@ -376,7 +401,6 @@ InstrProfiling::getOrCreateRegionCounter
   // the current function.
   Constant *ValuesPtrExpr = ConstantPointerNull::get(Int8PtrTy);
   if (ValueProfileStaticAlloc && !needsRuntimeRegistrationOfSectionRange(*M)) {
-
     uint64_t NS = 0;
     for (uint32_t Kind = IPVK_First; Kind <= IPVK_Last; ++Kind)
       NS += PD.NumValueSites[Kind];
@@ -392,7 +416,7 @@ InstrProfiling::getOrCreateRegionCounter
       ValuesVar->setAlignment(8);
       ValuesVar->setComdat(ProfileVarsComdat);
       ValuesPtrExpr =
-          ConstantExpr::getBitCast(ValuesVar, llvm::Type::getInt8PtrTy(Ctx));
+          ConstantExpr::getBitCast(ValuesVar, Type::getInt8PtrTy(Ctx));
     }
   }
 
@@ -481,7 +505,7 @@ void InstrProfiling::emitVNodes() {
 
   ArrayType *VNodesTy = ArrayType::get(VNodeTy, NumCounters);
   auto *VNodesVar = new GlobalVariable(
-      *M, VNodesTy, false, llvm::GlobalValue::PrivateLinkage,
+      *M, VNodesTy, false, GlobalValue::PrivateLinkage,
       Constant::getNullValue(VNodesTy), getInstrProfVNodesVarName());
   VNodesVar->setSection(getInstrProfVNodesSectionName(isMachO()));
   UsedVars.push_back(VNodesVar);
@@ -496,15 +520,15 @@ void InstrProfiling::emitNameData() {
   std::string CompressedNameStr;
   if (Error E = collectPGOFuncNameStrings(ReferencedNames, CompressedNameStr,
                                           DoNameCompression)) {
-    llvm::report_fatal_error(toString(std::move(E)), false);
+    report_fatal_error(toString(std::move(E)), false);
   }
 
   auto &Ctx = M->getContext();
-  auto *NamesVal = llvm::ConstantDataArray::getString(
+  auto *NamesVal = ConstantDataArray::getString(
       Ctx, StringRef(CompressedNameStr), false);
-  NamesVar = new llvm::GlobalVariable(*M, NamesVal->getType(), true,
-                                      llvm::GlobalValue::PrivateLinkage,
-                                      NamesVal, getInstrProfNamesVarName());
+  NamesVar = new GlobalVariable(*M, NamesVal->getType(), true,
+                                GlobalValue::PrivateLinkage, NamesVal,
+                                getInstrProfNamesVarName());
   NamesSize = CompressedNameStr.size();
   NamesVar->setSection(getNameSection());
   UsedVars.push_back(NamesVar);
@@ -550,7 +574,6 @@ void InstrProfiling::emitRegistration()
 }
 
 void InstrProfiling::emitRuntimeHook() {
-
   // We expect the linker to be invoked with -u<hook_var> flag for linux,
   // for which case there is no need to emit the user function.
   if (Triple(M->getTargetTriple()).isOSLinux())

Modified: llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp?rev=292320&r1=292319&r2=292320&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp Tue Jan 17 18:57:48 2017
@@ -12,20 +12,49 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/Transforms/Scalar/MemCpyOptimizer.h"
-#include "llvm/Transforms/Scalar.h"
 #include "llvm/ADT/DenseSet.h"
+#include "llvm/ADT/iterator_range.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/Statistic.h"
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/Analysis/AssumptionCache.h"
+#include "llvm/Analysis/GlobalsModRef.h"
+#include "llvm/Analysis/MemoryDependenceAnalysis.h"
+#include "llvm/Analysis/MemoryLocation.h"
+#include "llvm/Analysis/TargetLibraryInfo.h"
 #include "llvm/Analysis/ValueTracking.h"
+#include "llvm/IR/Argument.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/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/Intrinsics.h"
 #include "llvm/IR/IRBuilder.h"
+#include "llvm/IR/LLVMContext.h"
+#include "llvm/IR/Module.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/Casting.h"
 #include "llvm/Support/Debug.h"
+#include "llvm/Support/MathExtras.h"
 #include "llvm/Support/raw_ostream.h"
+#include "llvm/Transforms/Scalar.h"
+#include "llvm/Transforms/Scalar/MemCpyOptimizer.h"
 #include "llvm/Transforms/Utils/Local.h"
 #include <algorithm>
+#include <cassert>
+#include <cstdint>
+
 using namespace llvm;
 
 #define DEBUG_TYPE "memcpyopt"
@@ -119,6 +148,7 @@ static bool IsPointerOffset(Value *Ptr1,
   return true;
 }
 
+namespace {
 
 /// Represents a range of memset'd bytes with the ByteVal value.
 /// This allows us to analyze stores like:
@@ -130,7 +160,6 @@ static bool IsPointerOffset(Value *Ptr1,
 /// the first store, we make a range [1, 2).  The second store extends the range
 /// to [0, 2).  The third makes a new range [2, 3).  The fourth store joins the
 /// two ranges into [0, 3) which is memset'able.
-namespace {
 struct MemsetRange {
   // Start/End - A semi range that describes the span that this range covers.
   // The range is closed at the start and open at the end: [Start, End).
@@ -148,7 +177,8 @@ struct MemsetRange {
 
   bool isProfitableToUseMemset(const DataLayout &DL) const;
 };
-} // end anon namespace
+
+} // end anonymous namespace
 
 bool MemsetRange::isProfitableToUseMemset(const DataLayout &DL) const {
   // If we found more than 4 stores to merge or 16 bytes, use memset.
@@ -192,13 +222,14 @@ bool MemsetRange::isProfitableToUseMemse
   return TheStores.size() > NumPointerStores+NumByteStores;
 }
 
-
 namespace {
+
 class MemsetRanges {
   /// A sorted list of the memset ranges.
   SmallVector<MemsetRange, 8> Ranges;
   typedef SmallVectorImpl<MemsetRange>::iterator range_iterator;
   const DataLayout &DL;
+
 public:
   MemsetRanges(const DataLayout &DL) : DL(DL) {}
 
@@ -231,8 +262,7 @@ public:
 
 };
 
-} // end anon namespace
-
+} // end anonymous namespace
 
 /// Add a new store to the MemsetRanges data structure.  This adds a
 /// new range for the specified store at the specified offset, merging into
@@ -299,10 +329,13 @@ void MemsetRanges::addRange(int64_t Star
 //===----------------------------------------------------------------------===//
 
 namespace {
+
   class MemCpyOptLegacyPass : public FunctionPass {
     MemCpyOptPass Impl;
+
   public:
     static char ID; // Pass identification, replacement for typeid
+
     MemCpyOptLegacyPass() : FunctionPass(ID) {
       initializeMemCpyOptLegacyPassPass(*PassRegistry::getPassRegistry());
     }
@@ -340,7 +373,8 @@ namespace {
   };
 
   char MemCpyOptLegacyPass::ID = 0;
-}
+
+} // end anonymous namespace
 
 /// The public interface to this file...
 FunctionPass *llvm::createMemCpyOptPass() { return new MemCpyOptLegacyPass(); }
@@ -523,14 +557,15 @@ static bool moveUp(AliasAnalysis &AA, St
     if (Args.erase(C))
       NeedLift = true;
     else if (MayAlias) {
-      NeedLift = any_of(MemLocs, [C, &AA](const MemoryLocation &ML) {
+      NeedLift = llvm::any_of(MemLocs, [C, &AA](const MemoryLocation &ML) {
         return AA.getModRefInfo(C, ML);
       });
 
       if (!NeedLift)
-        NeedLift = any_of(CallSites, [C, &AA](const ImmutableCallSite &CS) {
-          return AA.getModRefInfo(C, CS);
-        });
+        NeedLift =
+            llvm::any_of(CallSites, [C, &AA](const ImmutableCallSite &CS) {
+              return AA.getModRefInfo(C, CS);
+            });
     }
 
     if (!NeedLift)
@@ -567,7 +602,7 @@ static bool moveUp(AliasAnalysis &AA, St
   }
 
   // We made it, we need to lift
-  for (auto *I : reverse(ToLift)) {
+  for (auto *I : llvm::reverse(ToLift)) {
     DEBUG(dbgs() << "Lifting " << *I << " before " << *P << "\n");
     I->moveBefore(P);
   }
@@ -761,7 +796,6 @@ bool MemCpyOptPass::processMemSet(MemSet
   return false;
 }
 
-
 /// Takes a memcpy and a call that it depends on,
 /// and checks for the possibility of a call slot optimization by having
 /// the call write its result directly into the destination of the memcpy.
@@ -1375,7 +1409,6 @@ bool MemCpyOptPass::iterateOnFunction(Fu
 }
 
 PreservedAnalyses MemCpyOptPass::run(Function &F, FunctionAnalysisManager &AM) {
-
   auto &MD = AM.getResult<MemoryDependenceAnalysis>(F);
   auto &TLI = AM.getResult<TargetLibraryAnalysis>(F);
 
@@ -1419,7 +1452,7 @@ bool MemCpyOptPass::runImpl(
   if (!TLI->has(LibFunc::memset) || !TLI->has(LibFunc::memcpy))
     return false;
 
-  while (1) {
+  while (true) {
     if (!iterateOnFunction(F))
       break;
     MadeChange = true;

Modified: llvm/trunk/lib/Transforms/Utils/SSAUpdater.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SSAUpdater.cpp?rev=292320&r1=292319&r2=292320&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/SSAUpdater.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/SSAUpdater.cpp Tue Jan 17 18:57:48 2017
@@ -11,20 +11,29 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/Transforms/Utils/SSAUpdater.h"
 #include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/TinyPtrVector.h"
 #include "llvm/Analysis/InstructionSimplify.h"
+#include "llvm/IR/BasicBlock.h"
 #include "llvm/IR/CFG.h"
 #include "llvm/IR/Constants.h"
+#include "llvm/IR/DebugLoc.h"
+#include "llvm/IR/Instruction.h"
 #include "llvm/IR/Instructions.h"
-#include "llvm/IR/IntrinsicInst.h"
 #include "llvm/IR/Module.h"
+#include "llvm/IR/Use.h"
+#include "llvm/IR/Value.h"
+#include "llvm/IR/ValueHandle.h"
+#include "llvm/Support/Casting.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/raw_ostream.h"
-#include "llvm/Transforms/Utils/BasicBlockUtils.h"
-#include "llvm/Transforms/Utils/Local.h"
+#include "llvm/Transforms/Utils/SSAUpdater.h"
 #include "llvm/Transforms/Utils/SSAUpdaterImpl.h"
+#include <cassert>
+#include <utility>
 
 using namespace llvm;
 
@@ -36,7 +45,7 @@ static AvailableValsTy &getAvailableVals
 }
 
 SSAUpdater::SSAUpdater(SmallVectorImpl<PHINode*> *NewPHI)
-  : AV(nullptr), ProtoType(nullptr), ProtoName(), InsertedPHIs(NewPHI) {}
+  : InsertedPHIs(NewPHI) {}
 
 SSAUpdater::~SSAUpdater() {
   delete static_cast<AvailableValsTy*>(AV);
@@ -205,6 +214,7 @@ void SSAUpdater::RewriteUseAfterInsertio
 }
 
 namespace llvm {
+
 template<>
 class SSAUpdaterTraits<SSAUpdater> {
 public:
@@ -230,6 +240,7 @@ public:
     PHI_iterator &operator++() { ++idx; return *this; } 
     bool operator==(const PHI_iterator& x) const { return idx == x.idx; }
     bool operator!=(const PHI_iterator& x) const { return !operator==(x); }
+
     Value *getIncomingValue() { return PHI->getIncomingValue(idx); }
     BasicBlock *getIncomingBlock() { return PHI->getIncomingBlock(idx); }
   };
@@ -303,7 +314,7 @@ public:
   }
 };
 
-} // End llvm namespace
+} // end namespace llvm
 
 /// Check to see if AvailableVals has an entry for the specified BB and if so,
 /// return it.  If not, construct SSA form by first calculating the required
@@ -337,14 +348,12 @@ LoadAndStorePromoter(ArrayRef<const Inst
   SSA.Initialize(SomeVal->getType(), BaseName);
 }
 
-
 void LoadAndStorePromoter::
 run(const SmallVectorImpl<Instruction*> &Insts) const {
-  
   // First step: bucket up uses of the alloca by the block they occur in.
   // This is important because we have to handle multiple defs/uses in a block
   // ourselves: SSAUpdater is purely for cross-block references.
-  DenseMap<BasicBlock*, TinyPtrVector<Instruction*> > UsesByBlock;
+  DenseMap<BasicBlock*, TinyPtrVector<Instruction*>> UsesByBlock;
 
   for (Instruction *User : Insts)
     UsesByBlock[User->getParent()].push_back(User);




More information about the llvm-commits mailing list