[llvm] r291983 - [Transforms/Utils] 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
Fri Jan 13 16:32:38 PST 2017


Author: eugenezelenko
Date: Fri Jan 13 18:32:38 2017
New Revision: 291983

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

Modified:
    llvm/trunk/include/llvm/Transforms/Utils/BasicBlockUtils.h
    llvm/trunk/include/llvm/Transforms/Utils/Cloning.h
    llvm/trunk/include/llvm/Transforms/Utils/GlobalStatus.h
    llvm/trunk/include/llvm/Transforms/Utils/LoopUtils.h
    llvm/trunk/include/llvm/Transforms/Utils/MemorySSA.h
    llvm/trunk/include/llvm/Transforms/Utils/NameAnonGlobals.h
    llvm/trunk/include/llvm/Transforms/Utils/SSAUpdater.h
    llvm/trunk/include/llvm/Transforms/Utils/SimplifyIndVar.h
    llvm/trunk/include/llvm/Transforms/Utils/SymbolRewriter.h
    llvm/trunk/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h
    llvm/trunk/include/llvm/Transforms/Utils/ValueMapper.h
    llvm/trunk/lib/Transforms/Utils/GlobalStatus.cpp

Modified: llvm/trunk/include/llvm/Transforms/Utils/BasicBlockUtils.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Utils/BasicBlockUtils.h?rev=291983&r1=291982&r2=291983&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Utils/BasicBlockUtils.h (original)
+++ llvm/trunk/include/llvm/Transforms/Utils/BasicBlockUtils.h Fri Jan 13 18:32:38 2017
@@ -78,14 +78,13 @@ void ReplaceInstWithInst(Instruction *Fr
 struct CriticalEdgeSplittingOptions {
   DominatorTree *DT;
   LoopInfo *LI;
-  bool MergeIdenticalEdges;
-  bool DontDeleteUselessPHIs;
-  bool PreserveLCSSA;
+  bool MergeIdenticalEdges = false;
+  bool DontDeleteUselessPHIs = false;
+  bool PreserveLCSSA = false;
 
   CriticalEdgeSplittingOptions(DominatorTree *DT = nullptr,
                                LoopInfo *LI = nullptr)
-      : DT(DT), LI(LI), MergeIdenticalEdges(false),
-        DontDeleteUselessPHIs(false), PreserveLCSSA(false) {}
+      : DT(DT), LI(LI) {}
 
   CriticalEdgeSplittingOptions &setMergeIdenticalEdges() {
     MergeIdenticalEdges = true;

Modified: llvm/trunk/include/llvm/Transforms/Utils/Cloning.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Utils/Cloning.h?rev=291983&r1=291982&r2=291983&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Utils/Cloning.h (original)
+++ llvm/trunk/include/llvm/Transforms/Utils/Cloning.h Fri Jan 13 18:32:38 2017
@@ -22,32 +22,27 @@
 #include "llvm/ADT/Twine.h"
 #include "llvm/Analysis/AliasAnalysis.h"
 #include "llvm/Analysis/AssumptionCache.h"
+#include "llvm/IR/CallSite.h"
 #include "llvm/IR/ValueHandle.h"
-#include "llvm/IR/ValueMap.h"
 #include "llvm/Transforms/Utils/ValueMapper.h"
 #include <functional>
+#include <memory>
+#include <vector>
 
 namespace llvm {
 
-class Module;
-class Function;
-class Instruction;
-class Pass;
-class LPPassManager;
+class AllocaInst;
 class BasicBlock;
-class Value;
 class CallInst;
-class InvokeInst;
-class ReturnInst;
-class CallSite;
-class Trace;
 class CallGraph;
-class DataLayout;
+class DominatorTree;
+class Function;
+class Instruction;
+class InvokeInst;
 class Loop;
 class LoopInfo;
-class AllocaInst;
-class AssumptionCacheTracker;
-class DominatorTree;
+class Module;
+class ReturnInst;
 
 /// Return an exact copy of the specified module
 ///
@@ -67,20 +62,20 @@ CloneModule(const Module *M, ValueToValu
 struct ClonedCodeInfo {
   /// ContainsCalls - This is set to true if the cloned code contains a normal
   /// call instruction.
-  bool ContainsCalls;
+  bool ContainsCalls = false;
 
   /// ContainsDynamicAllocas - This is set to true if the cloned code contains
   /// a 'dynamic' alloca.  Dynamic allocas are allocas that are either not in
   /// the entry block or they are in the entry block but are not a constant
   /// size.
-  bool ContainsDynamicAllocas;
+  bool ContainsDynamicAllocas = false;
 
   /// All cloned call sites that have operand bundles attached are appended to
   /// this vector.  This vector may contain nulls or undefs if some of the
   /// originally inserted callsites were DCE'ed after they were cloned.
   std::vector<WeakVH> OperandBundleCallSites;
 
-  ClonedCodeInfo() : ContainsCalls(false), ContainsDynamicAllocas(false) {}
+  ClonedCodeInfo() = default;
 };
 
 /// CloneBasicBlock - Return a copy of the specified basic block, but without
@@ -245,6 +240,6 @@ Loop *cloneLoopWithPreheader(BasicBlock
 void remapInstructionsInBlocks(const SmallVectorImpl<BasicBlock *> &Blocks,
                                ValueToValueMapTy &VMap);
 
-} // End llvm namespace
+} // end namespace llvm
 
-#endif
+#endif // LLVM_TRANSFORMS_UTILS_CLONING_H

Modified: llvm/trunk/include/llvm/Transforms/Utils/GlobalStatus.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Utils/GlobalStatus.h?rev=291983&r1=291982&r2=291983&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Utils/GlobalStatus.h (original)
+++ llvm/trunk/include/llvm/Transforms/Utils/GlobalStatus.h Fri Jan 13 18:32:38 2017
@@ -10,9 +10,10 @@
 #ifndef LLVM_TRANSFORMS_UTILS_GLOBALSTATUS_H
 #define LLVM_TRANSFORMS_UTILS_GLOBALSTATUS_H
 
-#include "llvm/IR/Instructions.h"
+#include "llvm/Support/AtomicOrdering.h"
 
 namespace llvm {
+
 class Value;
 class Function;
 
@@ -27,11 +28,11 @@ bool isSafeToDestroyConstant(const Const
 /// accurate.
 struct GlobalStatus {
   /// True if the global's address is used in a comparison.
-  bool IsCompared;
+  bool IsCompared = false;
 
   /// True if the global is ever loaded.  If the global isn't ever loaded it
   /// can be deleted.
-  bool IsLoaded;
+  bool IsLoaded = false;
 
   /// Keep track of what stores to the global look like.
   enum StoredType {
@@ -51,32 +52,33 @@ struct GlobalStatus {
     /// This global is stored to by multiple values or something else that we
     /// cannot track.
     Stored
-  } StoredType;
+  } StoredType = NotStored;
 
   /// If only one value (besides the initializer constant) is ever stored to
   /// this global, keep track of what value it is.
-  Value *StoredOnceValue;
+  Value *StoredOnceValue = nullptr;
 
   /// These start out null/false.  When the first accessing function is noticed,
   /// it is recorded. When a second different accessing function is noticed,
   /// HasMultipleAccessingFunctions is set to true.
-  const Function *AccessingFunction;
-  bool HasMultipleAccessingFunctions;
+  const Function *AccessingFunction = nullptr;
+  bool HasMultipleAccessingFunctions = false;
 
   /// Set to true if this global has a user that is not an instruction (e.g. a
   /// constant expr or GV initializer).
-  bool HasNonInstructionUser;
+  bool HasNonInstructionUser = false;
 
   /// Set to the strongest atomic ordering requirement.
-  AtomicOrdering Ordering;
+  AtomicOrdering Ordering = AtomicOrdering::NotAtomic;
+
+  GlobalStatus();
 
   /// Look at all uses of the global and fill in the GlobalStatus structure.  If
   /// the global has its address taken, return true to indicate we can't do
   /// anything with it.
   static bool analyzeGlobal(const Value *V, GlobalStatus &GS);
-
-  GlobalStatus();
 };
-}
 
-#endif
+} // end namespace llvm
+
+#endif // LLVM_TRANSFORMS_UTILS_GLOBALSTATUS_H

Modified: llvm/trunk/include/llvm/Transforms/Utils/LoopUtils.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Utils/LoopUtils.h?rev=291983&r1=291982&r2=291983&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Utils/LoopUtils.h (original)
+++ llvm/trunk/include/llvm/Transforms/Utils/LoopUtils.h Fri Jan 13 18:32:38 2017
@@ -1,4 +1,4 @@
-//===- llvm/Transforms/Utils/LoopUtils.h - Loop utilities -*- C++ -*-=========//
+//===- llvm/Transforms/Utils/LoopUtils.h - Loop utilities -------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -14,23 +14,29 @@
 #ifndef LLVM_TRANSFORMS_UTILS_LOOPUTILS_H
 #define LLVM_TRANSFORMS_UTILS_LOOPUTILS_H
 
+#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/Optional.h"
+#include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringRef.h"
 #include "llvm/Analysis/AliasAnalysis.h"
 #include "llvm/Analysis/EHPersonalities.h"
 #include "llvm/IR/Dominators.h"
 #include "llvm/IR/IRBuilder.h"
+#include "llvm/IR/InstrTypes.h"
+#include "llvm/IR/Operator.h"
+#include "llvm/IR/ValueHandle.h"
+#include "llvm/Support/Casting.h"
 
 namespace llvm {
+
 class AliasSet;
 class AliasSetTracker;
-class AssumptionCache;
 class BasicBlock;
 class DataLayout;
-class DominatorTree;
 class Loop;
 class LoopInfo;
 class OptimizationRemarkEmitter;
-class Pass;
 class PredicatedScalarEvolution;
 class PredIteratorCache;
 class ScalarEvolution;
@@ -40,12 +46,13 @@ class TargetLibraryInfo;
 /// \brief Captures loop safety information.
 /// It keep information for loop & its header may throw exception.
 struct LoopSafetyInfo {
-  bool MayThrow;       // The current loop contains an instruction which
-                       // may throw.
-  bool HeaderMayThrow; // Same as previous, but specific to loop header
+  bool MayThrow = false;       // The current loop contains an instruction which
+                               // may throw.
+  bool HeaderMayThrow = false; // Same as previous, but specific to loop header
   // Used to update funclet bundle operands.
   DenseMap<BasicBlock *, ColorVector> BlockColors;
-  LoopSafetyInfo() : MayThrow(false), HeaderMayThrow(false) {}
+
+  LoopSafetyInfo() = default;
 };
 
 /// The RecurrenceDescriptor is used to identify recurrences variables in a
@@ -61,7 +68,6 @@ struct LoopSafetyInfo {
 
 /// This struct holds information about recurrence variables.
 class RecurrenceDescriptor {
-
 public:
   /// This enum represents the kinds of recurrences that we support.
   enum RecurrenceKind {
@@ -88,10 +94,7 @@ public:
     MRK_FloatMax
   };
 
-  RecurrenceDescriptor()
-      : StartValue(nullptr), LoopExitInstr(nullptr), Kind(RK_NoRecurrence),
-        MinMaxKind(MRK_Invalid), UnsafeAlgebraInst(nullptr),
-        RecurrenceType(nullptr), IsSigned(false) {}
+  RecurrenceDescriptor() = default;
 
   RecurrenceDescriptor(Value *Start, Instruction *Exit, RecurrenceKind K,
                        MinMaxRecurrenceKind MK, Instruction *UAI, Type *RT,
@@ -103,7 +106,6 @@ public:
 
   /// This POD struct holds information about a potential recurrence operation.
   class InstDesc {
-
   public:
     InstDesc(bool IsRecur, Instruction *I, Instruction *UAI = nullptr)
         : IsRecurrence(IsRecur), PatternLastInst(I), MinMaxKind(MRK_Invalid),
@@ -242,17 +244,17 @@ private:
   // It does not have to be zero!
   TrackingVH<Value> StartValue;
   // The instruction who's value is used outside the loop.
-  Instruction *LoopExitInstr;
+  Instruction *LoopExitInstr = nullptr;
   // The kind of the recurrence.
-  RecurrenceKind Kind;
+  RecurrenceKind Kind = RK_NoRecurrence;
   // If this a min/max recurrence the kind of recurrence.
-  MinMaxRecurrenceKind MinMaxKind;
+  MinMaxRecurrenceKind MinMaxKind = MRK_Invalid;
   // First occurrence of unasfe algebra in the PHI's use-chain.
-  Instruction *UnsafeAlgebraInst;
+  Instruction *UnsafeAlgebraInst = nullptr;
   // The type of the recurrence.
-  Type *RecurrenceType;
+  Type *RecurrenceType = nullptr;
   // True if all source operands of the recurrence are SExtInsts.
-  bool IsSigned;
+  bool IsSigned = false;
   // Instructions used for type-promoting the recurrence.
   SmallPtrSet<Instruction *, 8> CastInsts;
 };
@@ -270,9 +272,7 @@ public:
 
 public:
   /// Default constructor - creates an invalid induction.
-  InductionDescriptor()
-    : StartValue(nullptr), IK(IK_NoInduction), Step(nullptr),
-    InductionBinOp(nullptr) {}
+  InductionDescriptor() = default;
 
   /// Get the consecutive direction. Returns:
   ///   0 - unknown or non-consecutive.
@@ -350,11 +350,11 @@ private:
   /// Start value.
   TrackingVH<Value> StartValue;
   /// Induction kind.
-  InductionKind IK;
+  InductionKind IK = IK_NoInduction;
   /// Step value.
-  const SCEV *Step;
+  const SCEV *Step = nullptr;
   // Instruction that advances induction variable.
-  BinaryOperator *InductionBinOp;
+  BinaryOperator *InductionBinOp = nullptr;
 };
 
 BasicBlock *InsertPreheaderForLoop(Loop *L, DominatorTree *DT, LoopInfo *LI,
@@ -488,6 +488,7 @@ bool canSinkOrHoistInst(Instruction &I,
                         Loop *CurLoop, AliasSetTracker *CurAST,
                         LoopSafetyInfo *SafetyInfo,
                         OptimizationRemarkEmitter *ORE = nullptr);
-}
 
-#endif
+} // end namespace llvm
+
+#endif // LLVM_TRANSFORMS_UTILS_LOOPUTILS_H

Modified: llvm/trunk/include/llvm/Transforms/Utils/MemorySSA.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Utils/MemorySSA.h?rev=291983&r1=291982&r2=291983&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Utils/MemorySSA.h (original)
+++ llvm/trunk/include/llvm/Transforms/Utils/MemorySSA.h Fri Jan 13 18:32:38 2017
@@ -74,6 +74,7 @@
 
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/GraphTraits.h"
+#include "llvm/ADT/iterator_range.h"
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/ilist.h"
@@ -91,9 +92,7 @@
 #include "llvm/IR/User.h"
 #include "llvm/IR/Value.h"
 #include "llvm/Pass.h"
-#include "llvm/PassAnalysisSupport.h"
 #include "llvm/Support/Casting.h"
-#include "llvm/Support/Compiler.h"
 #include "llvm/Support/ErrorHandling.h"
 #include <algorithm>
 #include <cassert>
@@ -104,12 +103,12 @@
 
 namespace llvm {
 
-class DominatorTree;
 class Function;
 class Instruction;
 class MemoryAccess;
 class LLVMContext;
 class raw_ostream;
+
 enum {
   // Used to signify what the default invalid ID is for MemoryAccess's
   // getID()
@@ -124,9 +123,6 @@ using const_memoryaccess_def_iterator =
 // \brief The base for all memory accesses. All memory accesses in a block are
 // linked together using an intrusive list.
 class MemoryAccess : public User, public ilist_node<MemoryAccess> {
-  void *operator new(size_t, unsigned) = delete;
-  void *operator new(size_t) = delete;
-
 public:
   // Methods for support type inquiry through isa, cast, and
   // dyn_cast
@@ -136,8 +132,13 @@ public:
     return ID == MemoryUseVal || ID == MemoryPhiVal || ID == MemoryDefVal;
   }
 
+  MemoryAccess(const MemoryAccess &) = delete;
+  MemoryAccess &operator=(const MemoryAccess &) = delete;
   ~MemoryAccess() override;
 
+  void *operator new(size_t, unsigned) = delete;
+  void *operator new(size_t) = delete;
+
   BasicBlock *getBlock() const { return Block; }
 
   virtual void print(raw_ostream &OS) const = 0;
@@ -171,8 +172,6 @@ protected:
       : User(Type::getVoidTy(C), Vty, nullptr, NumOperands), Block(BB) {}
 
 private:
-  MemoryAccess(const MemoryAccess &);
-  void operator=(const MemoryAccess &);
   BasicBlock *Block;
 };
 
@@ -189,10 +188,10 @@ inline raw_ostream &operator<<(raw_ostre
 /// This class should never be instantiated directly; make a MemoryUse or
 /// MemoryDef instead.
 class MemoryUseOrDef : public MemoryAccess {
+public:
   void *operator new(size_t, unsigned) = delete;
   void *operator new(size_t) = delete;
 
-public:
   DECLARE_TRANSPARENT_OPERAND_ACCESSORS(MemoryAccess);
 
   /// \brief Get the instruction that this MemoryUse represents.
@@ -232,31 +231,33 @@ DEFINE_TRANSPARENT_OPERAND_ACCESSORS(Mem
 /// MemoryUse's is exactly the set of Instructions for which
 /// AliasAnalysis::getModRefInfo returns "Ref".
 class MemoryUse final : public MemoryUseOrDef {
-  void *operator new(size_t, unsigned) = delete;
-
 public:
   DECLARE_TRANSPARENT_OPERAND_ACCESSORS(MemoryAccess);
 
-  // allocate space for exactly one operand
-  void *operator new(size_t s) { return User::operator new(s, 1); }
-
   MemoryUse(LLVMContext &C, MemoryAccess *DMA, Instruction *MI, BasicBlock *BB)
       : MemoryUseOrDef(C, DMA, MemoryUseVal, MI, BB), OptimizedID(0) {}
 
+  // allocate space for exactly one operand
+  void *operator new(size_t s) { return User::operator new(s, 1); }
+  void *operator new(size_t, unsigned) = delete;
+
   static inline bool classof(const MemoryUse *) { return true; }
   static inline bool classof(const Value *MA) {
     return MA->getValueID() == MemoryUseVal;
   }
 
   void print(raw_ostream &OS) const override;
+
   void setDefiningAccess(MemoryAccess *DMA, bool Optimized = false) {
     if (Optimized)
       OptimizedID = DMA->getID();
     MemoryUseOrDef::setDefiningAccess(DMA);
   }
+
   bool isOptimized() const {
     return getDefiningAccess() && OptimizedID == getDefiningAccess()->getID();
   }
+
   /// \brief Reset the ID of what this MemoryUse was optimized to, causing it to
   /// be rewalked by the walker if necessary.
   /// This really should only be called by tests.
@@ -287,18 +288,17 @@ DEFINE_TRANSPARENT_OPERAND_ACCESSORS(Mem
 /// associated with them. This use points to the nearest reaching
 /// MemoryDef/MemoryPhi.
 class MemoryDef final : public MemoryUseOrDef {
-  void *operator new(size_t, unsigned) = delete;
-
 public:
   DECLARE_TRANSPARENT_OPERAND_ACCESSORS(MemoryAccess);
 
-  // allocate space for exactly one operand
-  void *operator new(size_t s) { return User::operator new(s, 1); }
-
   MemoryDef(LLVMContext &C, MemoryAccess *DMA, Instruction *MI, BasicBlock *BB,
             unsigned Ver)
       : MemoryUseOrDef(C, DMA, MemoryDefVal, MI, BB), ID(Ver) {}
 
+  // allocate space for exactly one operand
+  void *operator new(size_t s) { return User::operator new(s, 1); }
+  void *operator new(size_t, unsigned) = delete;
+
   static inline bool classof(const MemoryDef *) { return true; }
   static inline bool classof(const Value *MA) {
     return MA->getValueID() == MemoryDefVal;
@@ -352,7 +352,6 @@ DEFINE_TRANSPARENT_OPERAND_ACCESSORS(Mem
 /// Because MemoryUse's do not generate new definitions, they do not have this
 /// issue.
 class MemoryPhi final : public MemoryAccess {
-  void *operator new(size_t, unsigned) = delete;
   // allocate space for exactly zero operands
   void *operator new(size_t s) { return User::operator new(s); }
 
@@ -365,6 +364,8 @@ public:
     allocHungoffUses(ReservedSpace);
   }
 
+  void *operator new(size_t, unsigned) = delete;
+
   // Block iterator interface. This provides access to the list of incoming
   // basic blocks, which parallels the list of incoming values.
   typedef BasicBlock **block_iterator;
@@ -466,6 +467,7 @@ public:
 
 protected:
   friend class MemorySSA;
+
   /// \brief this is more complicated than the generic
   /// User::allocHungoffUses, because we have to allocate Uses for the incoming
   /// values and pointers to the incoming blocks, all in one allocation.
@@ -561,6 +563,7 @@ public:
   MemoryAccess *createMemoryAccessInBB(Instruction *I, MemoryAccess *Definition,
                                        const BasicBlock *BB,
                                        InsertionPlace Point);
+
   /// \brief Create a MemoryAccess in MemorySSA before or after an existing
   /// MemoryAccess.
   ///
@@ -615,6 +618,7 @@ protected:
   // Used by Memory SSA annotater, dumpers, and wrapper pass
   friend class MemorySSAAnnotatedWriter;
   friend class MemorySSAPrinterLegacyPass;
+
   void verifyDefUses(Function &F) const;
   void verifyDomination(Function &F) const;
   void verifyOrdering(Function &F) const;
@@ -680,15 +684,17 @@ class MemorySSAPrinterLegacyPass : publi
 public:
   MemorySSAPrinterLegacyPass();
 
-  static char ID;
   bool runOnFunction(Function &) override;
   void getAnalysisUsage(AnalysisUsage &AU) const override;
+
+  static char ID;
 };
 
 /// An analysis that produces \c MemorySSA for a function.
 ///
 class MemorySSAAnalysis : public AnalysisInfoMixin<MemorySSAAnalysis> {
   friend AnalysisInfoMixin<MemorySSAAnalysis>;
+
   static AnalysisKey Key;
 
 public:
@@ -711,6 +717,7 @@ class MemorySSAPrinterPass : public Pass
 
 public:
   explicit MemorySSAPrinterPass(raw_ostream &OS) : OS(OS) {}
+
   PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 };
 
@@ -725,6 +732,7 @@ public:
   MemorySSAWrapperPass();
 
   static char ID;
+
   bool runOnFunction(Function &) override;
   void releaseMemory() override;
   MemorySSA &getMSSA() { return *MSSA; }
@@ -753,7 +761,7 @@ private:
 class MemorySSAWalker {
 public:
   MemorySSAWalker(MemorySSA *);
-  virtual ~MemorySSAWalker() {}
+  virtual ~MemorySSAWalker() = default;
 
   using MemoryAccessSet = SmallVector<MemoryAccess *, 8>;
 
@@ -825,6 +833,7 @@ public:
   // Keep the overrides below from hiding the Instruction overload of
   // getClobberingMemoryAccess.
   using MemorySSAWalker::getClobberingMemoryAccess;
+
   MemoryAccess *getClobberingMemoryAccess(MemoryAccess *) override;
   MemoryAccess *getClobberingMemoryAccess(MemoryAccess *,
                                           const MemoryLocation &) override;
@@ -843,8 +852,9 @@ class memoryaccess_def_iterator_base
   using BaseT = typename memoryaccess_def_iterator_base::iterator_facade_base;
 
 public:
-  memoryaccess_def_iterator_base(T *Start) : Access(Start), ArgNo(0) {}
-  memoryaccess_def_iterator_base() : Access(nullptr), ArgNo(0) {}
+  memoryaccess_def_iterator_base(T *Start) : Access(Start) {}
+  memoryaccess_def_iterator_base() = default;
+
   bool operator==(const memoryaccess_def_iterator_base &Other) const {
     return Access == Other.Access && (!Access || ArgNo == Other.ArgNo);
   }
@@ -883,8 +893,8 @@ public:
   }
 
 private:
-  T *Access;
-  unsigned ArgNo;
+  T *Access = nullptr;
+  unsigned ArgNo = 0;
 };
 
 inline memoryaccess_def_iterator MemoryAccess::defs_begin() {
@@ -947,8 +957,7 @@ public:
     fillInCurrentPair();
   }
 
-  upward_defs_iterator()
-      : DefIterator(), Location(), OriginalAccess(), WalkingPhi(false) {
+  upward_defs_iterator() {
     CurrentPair.first = nullptr;
   }
 
@@ -995,8 +1004,8 @@ private:
   MemoryAccessPair CurrentPair;
   memoryaccess_def_iterator DefIterator;
   MemoryLocation Location;
-  MemoryAccess *OriginalAccess;
-  bool WalkingPhi;
+  MemoryAccess *OriginalAccess = nullptr;
+  bool WalkingPhi = false;
 };
 
 inline upward_defs_iterator upward_defs_begin(const MemoryAccessPair &Pair) {

Modified: llvm/trunk/include/llvm/Transforms/Utils/NameAnonGlobals.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Utils/NameAnonGlobals.h?rev=291983&r1=291982&r2=291983&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Utils/NameAnonGlobals.h (original)
+++ llvm/trunk/include/llvm/Transforms/Utils/NameAnonGlobals.h Fri Jan 13 18:32:38 2017
@@ -1,4 +1,4 @@
-//===-- NameAnonGlobals.h - Anonymous Global Naming Pass ----*- C++ -*-=======//
+//===-- NameAnonGlobals.h - Anonymous Global Naming Pass --------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -23,9 +23,11 @@ namespace llvm {
 /// Simple pass that provides a name to every anonymous globals.
 class NameAnonGlobalPass : public PassInfoMixin<NameAnonGlobalPass> {
 public:
-  NameAnonGlobalPass() {}
+  NameAnonGlobalPass() = default;
+
   PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
 };
-}
+
+} // end namespace llvm
 
 #endif // LLVM_TRANSFORMS_UTILS_NAMEANONGLOBALS_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=291983&r1=291982&r2=291983&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Utils/SSAUpdater.h (original)
+++ llvm/trunk/include/llvm/Transforms/Utils/SSAUpdater.h Fri Jan 13 18:32:38 2017
@@ -15,19 +15,20 @@
 #define LLVM_TRANSFORMS_UTILS_SSAUPDATER_H
 
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Support/Compiler.h"
+#include <string>
 
 namespace llvm {
-  class BasicBlock;
-  class Instruction;
-  class LoadInst;
-  template <typename T> class ArrayRef;
-  template <typename T> class SmallVectorImpl;
-  template <typename T> class SSAUpdaterTraits;
-  class PHINode;
-  class Type;
-  class Use;
-  class Value;
+
+class BasicBlock;
+class Instruction;
+class LoadInst;
+template <typename T> class ArrayRef;
+template <typename T> class SmallVectorImpl;
+template <typename T> class SSAUpdaterTraits;
+class PHINode;
+class Type;
+class Use;
+class Value;
 
 /// \brief Helper class for SSA formation on a set of values defined in
 /// multiple blocks.
@@ -58,6 +59,8 @@ public:
   /// If InsertedPHIs is specified, it will be filled
   /// in with all PHI Nodes created by rewriting.
   explicit SSAUpdater(SmallVectorImpl<PHINode*> *InsertedPHIs = nullptr);
+  SSAUpdater(const SSAUpdater &) = delete;
+  SSAUpdater &operator=(const SSAUpdater &) = delete;
   ~SSAUpdater();
 
   /// \brief Reset this object to get ready for a new set of SSA updates with
@@ -118,9 +121,6 @@ public:
 
 private:
   Value *GetValueAtEndOfBlockInternal(BasicBlock *BB);
-
-  void operator=(const SSAUpdater&) = delete;
-  SSAUpdater(const SSAUpdater&) = delete;
 };
 
 /// \brief Helper class for promoting a collection of loads and stores into SSA
@@ -138,7 +138,7 @@ protected:
 public:
   LoadAndStorePromoter(ArrayRef<const Instruction*> Insts,
                        SSAUpdater &S, StringRef Name = StringRef());
-  virtual ~LoadAndStorePromoter() {}
+  virtual ~LoadAndStorePromoter() = default;
 
   /// \brief This does the promotion.
   ///
@@ -173,6 +173,6 @@ public:
   }
 };
 
-} // End llvm namespace
+} // end namespace llvm
 
-#endif
+#endif // LLVM_TRANSFORMS_UTILS_SSAUPDATER_H

Modified: llvm/trunk/include/llvm/Transforms/Utils/SimplifyIndVar.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Utils/SimplifyIndVar.h?rev=291983&r1=291982&r2=291983&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Utils/SimplifyIndVar.h (original)
+++ llvm/trunk/include/llvm/Transforms/Utils/SimplifyIndVar.h Fri Jan 13 18:32:38 2017
@@ -22,7 +22,6 @@ namespace llvm {
 
 class CastInst;
 class DominatorTree;
-class IVUsers;
 class Loop;
 class LoopInfo;
 class PHINode;
@@ -32,13 +31,13 @@ class ScalarEvolution;
 /// simplified by this utility.
 class IVVisitor {
 protected:
-  const DominatorTree *DT;
+  const DominatorTree *DT = nullptr;
 
   virtual void anchor();
 
 public:
-  IVVisitor() : DT(nullptr) {}
-  virtual ~IVVisitor() {}
+  IVVisitor() = default;
+  virtual ~IVVisitor() = default;
 
   const DominatorTree *getDomTree() const { return DT; }
   virtual void visitCast(CastInst *Cast) = 0;
@@ -55,6 +54,6 @@ bool simplifyUsersOfIV(PHINode *CurrIV,
 bool simplifyLoopIVs(Loop *L, ScalarEvolution *SE, DominatorTree *DT,
                      LoopInfo *LI, SmallVectorImpl<WeakVH> &Dead);
 
-} // namespace llvm
+} // end namespace llvm
 
-#endif
+#endif // LLVM_TRANSFORMS_UTILS_SIMPLIFYINDVAR_H

Modified: llvm/trunk/include/llvm/Transforms/Utils/SymbolRewriter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Utils/SymbolRewriter.h?rev=291983&r1=291982&r2=291983&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Utils/SymbolRewriter.h (original)
+++ llvm/trunk/include/llvm/Transforms/Utils/SymbolRewriter.h Fri Jan 13 18:32:38 2017
@@ -36,18 +36,24 @@
 #include "llvm/IR/Module.h"
 #include "llvm/IR/PassManager.h"
 #include <list>
+#include <memory>
+#include <string>
 
 namespace llvm {
+
 class MemoryBuffer;
 
 namespace yaml {
+
 class KeyValueNode;
 class MappingNode;
 class ScalarNode;
 class Stream;
-}
+
+} // end namespace yaml
 
 namespace SymbolRewriter {
+
 /// The basic entity representing a rewrite operation.  It serves as the base
 /// class for any rewrite descriptor.  It has a certain set of specializations
 /// which describe a particular rewrite.
@@ -60,11 +66,6 @@ namespace SymbolRewriter {
 /// select the symbols to rewrite.  This descriptor list is passed to the
 /// SymbolRewriter pass.
 class RewriteDescriptor {
-  RewriteDescriptor(const RewriteDescriptor &) = delete;
-
-  const RewriteDescriptor &
-  operator=(const RewriteDescriptor &) = delete;
-
 public:
   enum class Type {
     Invalid,        /// invalid
@@ -73,7 +74,9 @@ public:
     NamedAlias,     /// named alias - descriptor rewrites a global alias
   };
 
-  virtual ~RewriteDescriptor() {}
+  RewriteDescriptor(const RewriteDescriptor &) = delete;
+  RewriteDescriptor &operator=(const RewriteDescriptor &) = delete;
+  virtual ~RewriteDescriptor() = default;
 
   Type getType() const { return Kind; }
 
@@ -108,7 +111,8 @@ private:
                                          yaml::MappingNode *V,
                                          RewriteDescriptorList *DL);
 };
-}
+
+} // end namespace SymbolRewriter
 
 ModulePass *createRewriteSymbolsPass();
 ModulePass *createRewriteSymbolsPass(SymbolRewriter::RewriteDescriptorList &);
@@ -130,6 +134,7 @@ private:
 
   SymbolRewriter::RewriteDescriptorList Descriptors;  
 };
-}
+
+} // end namespace llvm
 
 #endif //LLVM_TRANSFORMS_UTILS_SYMBOLREWRITER_H

Modified: llvm/trunk/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h?rev=291983&r1=291982&r2=291983&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h (original)
+++ llvm/trunk/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h Fri Jan 13 18:32:38 2017
@@ -19,16 +19,18 @@
 #define LLVM_TRANSFORMS_UTILS_UNIFYFUNCTIONEXITNODES_H
 
 #include "llvm/Pass.h"
+#include "llvm/PassRegistry.h"
 
 namespace llvm {
 
 struct UnifyFunctionExitNodes : public FunctionPass {
-  BasicBlock *ReturnBlock, *UnwindBlock, *UnreachableBlock;
+  BasicBlock *ReturnBlock = nullptr;
+  BasicBlock *UnwindBlock = nullptr;
+  BasicBlock *UnreachableBlock;
 
 public:
   static char ID; // Pass identification, replacement for typeid
-  UnifyFunctionExitNodes() : FunctionPass(ID),
-                             ReturnBlock(nullptr), UnwindBlock(nullptr) {
+  UnifyFunctionExitNodes() : FunctionPass(ID) {
     initializeUnifyFunctionExitNodesPass(*PassRegistry::getPassRegistry());
   }
 
@@ -47,6 +49,6 @@ public:
 
 Pass *createUnifyFunctionExitNodesPass();
 
-} // End llvm namespace
+} // end namespace llvm
 
-#endif
+#endif // LLVM_TRANSFORMS_UTILS_UNIFYFUNCTIONEXITNODES_H

Modified: llvm/trunk/include/llvm/Transforms/Utils/ValueMapper.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Utils/ValueMapper.h?rev=291983&r1=291982&r2=291983&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Utils/ValueMapper.h (original)
+++ llvm/trunk/include/llvm/Transforms/Utils/ValueMapper.h Fri Jan 13 18:32:38 2017
@@ -15,7 +15,9 @@
 #ifndef LLVM_TRANSFORMS_UTILS_VALUEMAPPER_H
 #define LLVM_TRANSFORMS_UTILS_VALUEMAPPER_H
 
+#include "llvm/ADT/ArrayRef.h"
 #include "llvm/IR/ValueMap.h"
+#include "llvm/IR/ValueHandle.h"
 
 namespace llvm {
 
@@ -27,8 +29,9 @@ typedef ValueMap<const Value *, WeakVH>
 /// cloning constants and instructions.
 class ValueMapTypeRemapper {
   virtual void anchor(); // Out of line method.
+
 public:
-  virtual ~ValueMapTypeRemapper() {}
+  virtual ~ValueMapTypeRemapper() = default;
 
   /// The client should implement this method if they want to remap types while
   /// mapping values.
@@ -92,8 +95,6 @@ static inline RemapFlags operator|(Remap
   return RemapFlags(unsigned(LHS) | unsigned(RHS));
 }
 
-class ValueMapperImpl;
-
 /// Context for (re-)mapping values (and metadata).
 ///
 /// A shared context used for mapping and remapping of Value and Metadata
@@ -133,15 +134,14 @@ class ValueMapperImpl;
 class ValueMapper {
   void *pImpl;
 
-  ValueMapper(ValueMapper &&) = delete;
-  ValueMapper(const ValueMapper &) = delete;
-  ValueMapper &operator=(ValueMapper &&) = delete;
-  ValueMapper &operator=(const ValueMapper &) = delete;
-
 public:
   ValueMapper(ValueToValueMapTy &VM, RemapFlags Flags = RF_None,
               ValueMapTypeRemapper *TypeMapper = nullptr,
               ValueMaterializer *Materializer = nullptr);
+  ValueMapper(ValueMapper &&) = delete;
+  ValueMapper(const ValueMapper &) = delete;
+  ValueMapper &operator=(ValueMapper &&) = delete;
+  ValueMapper &operator=(const ValueMapper &) = delete;
   ~ValueMapper();
 
   /// Register an alternate mapping context.
@@ -268,6 +268,6 @@ inline Constant *MapValue(const Constant
   return ValueMapper(VM, Flags, TypeMapper, Materializer).mapConstant(*V);
 }
 
-} // End llvm namespace
+} // end namespace llvm
 
-#endif
+#endif // LLVM_TRANSFORMS_UTILS_VALUEMAPPER_H

Modified: llvm/trunk/lib/Transforms/Utils/GlobalStatus.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/GlobalStatus.cpp?rev=291983&r1=291982&r2=291983&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/GlobalStatus.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/GlobalStatus.cpp Fri Jan 13 18:32:38 2017
@@ -10,9 +10,22 @@
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/IR/BasicBlock.h"
 #include "llvm/IR/CallSite.h"
+#include "llvm/IR/Constant.h"
+#include "llvm/IR/Constants.h"
+#include "llvm/IR/GlobalValue.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/Transforms/Utils/GlobalStatus.h"
+#include "llvm/IR/Use.h"
+#include "llvm/IR/User.h"
+#include "llvm/IR/Value.h"
+#include "llvm/Support/AtomicOrdering.h"
+#include "llvm/Support/Casting.h"
+#include <algorithm>
+#include <cassert>
 
 using namespace llvm;
 
@@ -175,13 +188,9 @@ static bool analyzeGlobalAux(const Value
   return false;
 }
 
+GlobalStatus::GlobalStatus() = default;
+
 bool GlobalStatus::analyzeGlobal(const Value *V, GlobalStatus &GS) {
   SmallPtrSet<const PHINode *, 16> PhiUsers;
   return analyzeGlobalAux(V, GS, PhiUsers);
 }
-
-GlobalStatus::GlobalStatus()
-    : IsCompared(false), IsLoaded(false), StoredType(NotStored),
-      StoredOnceValue(nullptr), AccessingFunction(nullptr),
-      HasMultipleAccessingFunctions(false), HasNonInstructionUser(false),
-      Ordering(AtomicOrdering::NotAtomic) {}




More information about the llvm-commits mailing list