summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDylan Noblesmith <nobled@dreamwidth.org>2014-08-25 00:28:43 +0000
committerDylan Noblesmith <nobled@dreamwidth.org>2014-08-25 00:28:43 +0000
commit3ecd22fcf5ae4d06d801d9d88c490931fac62ed5 (patch)
treeac72bc73b3a4b7bb49448d2292a208ae94c55f7d
parent2cae60e730aef621ab415124fdabb3e5a3884f2b (diff)
downloadbcm5719-llvm-3ecd22fcf5ae4d06d801d9d88c490931fac62ed5.tar.gz
bcm5719-llvm-3ecd22fcf5ae4d06d801d9d88c490931fac62ed5.zip
Analysis: unique_ptr-ify DependenceAnalysis::collectCoeffInfo
llvm-svn: 216358
-rw-r--r--llvm/include/llvm/Analysis/DependenceAnalysis.h7
-rw-r--r--llvm/lib/Analysis/DependenceAnalysis.cpp16
2 files changed, 12 insertions, 11 deletions
diff --git a/llvm/include/llvm/Analysis/DependenceAnalysis.h b/llvm/include/llvm/Analysis/DependenceAnalysis.h
index a52d6a8ef2d..d032a418366 100644
--- a/llvm/include/llvm/Analysis/DependenceAnalysis.h
+++ b/llvm/include/llvm/Analysis/DependenceAnalysis.h
@@ -766,9 +766,10 @@ namespace llvm {
/// collectCoefficientInfo - Walks through the subscript,
/// collecting each coefficient, the associated loop bounds,
/// and recording its positive and negative parts for later use.
- CoefficientInfo *collectCoeffInfo(const SCEV *Subscript,
- bool SrcFlag,
- const SCEV *&Constant) const;
+ std::unique_ptr<CoefficientInfo[]>
+ collectCoeffInfo(const SCEV *Subscript,
+ bool SrcFlag,
+ const SCEV *&Constant) const;
/// getPositivePart - X^+ = max(X, 0).
///
diff --git a/llvm/lib/Analysis/DependenceAnalysis.cpp b/llvm/lib/Analysis/DependenceAnalysis.cpp
index be4e487a149..8120736885c 100644
--- a/llvm/lib/Analysis/DependenceAnalysis.cpp
+++ b/llvm/lib/Analysis/DependenceAnalysis.cpp
@@ -2437,11 +2437,14 @@ bool DependenceAnalysis::banerjeeMIVtest(const SCEV *Src,
++BanerjeeApplications;
DEBUG(dbgs() << " Src = " << *Src << '\n');
const SCEV *A0;
- CoefficientInfo *A = collectCoeffInfo(Src, true, A0);
+ auto AOwner = collectCoeffInfo(Src, true, A0);
+ auto A = AOwner.get();
DEBUG(dbgs() << " Dst = " << *Dst << '\n');
const SCEV *B0;
- CoefficientInfo *B = collectCoeffInfo(Dst, false, B0);
- BoundInfo *Bound = new BoundInfo[MaxLevels + 1];
+ auto BOwner = collectCoeffInfo(Dst, false, B0);
+ auto B = BOwner.get();
+ auto BoundOwner = make_unique<BoundInfo[]>(MaxLevels + 1);
+ auto Bound = BoundOwner.get();
const SCEV *Delta = SE->getMinusSCEV(B0, A0);
DEBUG(dbgs() << "\tDelta = " << *Delta << '\n');
@@ -2498,9 +2501,6 @@ bool DependenceAnalysis::banerjeeMIVtest(const SCEV *Src,
++BanerjeeIndependence;
Disproved = true;
}
- delete [] Bound;
- delete [] A;
- delete [] B;
return Disproved;
}
@@ -2818,12 +2818,12 @@ const SCEV *DependenceAnalysis::getNegativePart(const SCEV *X) const {
// Walks through the subscript,
// collecting each coefficient, the associated loop bounds,
// and recording its positive and negative parts for later use.
-DependenceAnalysis::CoefficientInfo *
+std::unique_ptr<DependenceAnalysis::CoefficientInfo[]>
DependenceAnalysis::collectCoeffInfo(const SCEV *Subscript,
bool SrcFlag,
const SCEV *&Constant) const {
const SCEV *Zero = SE->getConstant(Subscript->getType(), 0);
- CoefficientInfo *CI = new CoefficientInfo[MaxLevels + 1];
+ auto CI = make_unique<CoefficientInfo[]>(MaxLevels + 1);
for (unsigned K = 1; K <= MaxLevels; ++K) {
CI[K].Coeff = Zero;
CI[K].PosPart = Zero;
OpenPOWER on IntegriCloud