[llvm] r231104 - unique_ptrify FullDependenceAnalysis::DV

David Blaikie dblaikie at gmail.com
Tue Mar 3 11:20:18 PST 2015


Author: dblaikie
Date: Tue Mar  3 13:20:18 2015
New Revision: 231104

URL: http://llvm.org/viewvc/llvm-project?rev=231104&view=rev
Log:
unique_ptrify FullDependenceAnalysis::DV

Making this type a little harder to abuse (see workaround relating to
use of the implicit copy ctor in the prior commit)

Modified:
    llvm/trunk/include/llvm/Analysis/DependenceAnalysis.h
    llvm/trunk/lib/Analysis/DependenceAnalysis.cpp

Modified: llvm/trunk/include/llvm/Analysis/DependenceAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DependenceAnalysis.h?rev=231104&r1=231103&r2=231104&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/DependenceAnalysis.h (original)
+++ llvm/trunk/include/llvm/Analysis/DependenceAnalysis.h Tue Mar  3 13:20:18 2015
@@ -221,9 +221,6 @@ namespace llvm {
                    Instruction *Dst,
                    bool LoopIndependent,
                    unsigned Levels);
-    ~FullDependence() {
-      delete[] DV;
-    }
 
     /// isLoopIndependent - Returns true if this is a loop-independent
     /// dependence.
@@ -270,7 +267,7 @@ namespace llvm {
     unsigned short Levels;
     bool LoopIndependent;
     bool Consistent; // Init to true, then refine.
-    DVEntry *DV;
+    std::unique_ptr<DVEntry[]> DV;
     friend class DependenceAnalysis;
   };
 

Modified: llvm/trunk/lib/Analysis/DependenceAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DependenceAnalysis.cpp?rev=231104&r1=231103&r2=231104&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/DependenceAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/DependenceAnalysis.cpp Tue Mar  3 13:20:18 2015
@@ -226,16 +226,12 @@ bool Dependence::isScalar(unsigned level
 //===----------------------------------------------------------------------===//
 // FullDependence methods
 
-FullDependence::FullDependence(Instruction *Source,
-                               Instruction *Destination,
+FullDependence::FullDependence(Instruction *Source, Instruction *Destination,
                                bool PossiblyLoopIndependent,
-                               unsigned CommonLevels) :
-  Dependence(Source, Destination),
-  Levels(CommonLevels),
-  LoopIndependent(PossiblyLoopIndependent) {
-  Consistent = true;
-  DV = CommonLevels ? new DVEntry[CommonLevels] : nullptr;
-}
+                               unsigned CommonLevels)
+    : Dependence(Source, Destination), Levels(CommonLevels),
+      LoopIndependent(PossiblyLoopIndependent), Consistent(true),
+      DV(CommonLevels ? new DVEntry[CommonLevels] : nullptr) {}
 
 // The rest are simple getters that hide the implementation.
 





More information about the llvm-commits mailing list