summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDylan Noblesmith <nobled@dreamwidth.org>2014-08-25 00:28:39 +0000
committerDylan Noblesmith <nobled@dreamwidth.org>2014-08-25 00:28:39 +0000
commit2cae60e730aef621ab415124fdabb3e5a3884f2b (patch)
treedb9558da602b17fa1c2af49cdd7a495ed7942e42
parentd96ce66cb183fab3884eac3929f9c6b2cc66664c (diff)
downloadbcm5719-llvm-2cae60e730aef621ab415124fdabb3e5a3884f2b.tar.gz
bcm5719-llvm-2cae60e730aef621ab415124fdabb3e5a3884f2b.zip
Analysis: unique_ptr-ify DependenceAnalysis::depends
llvm-svn: 216357
-rw-r--r--llvm/include/llvm/Analysis/DependenceAnalysis.h6
-rw-r--r--llvm/lib/Analysis/DependenceAnalysis.cpp16
2 files changed, 11 insertions, 11 deletions
diff --git a/llvm/include/llvm/Analysis/DependenceAnalysis.h b/llvm/include/llvm/Analysis/DependenceAnalysis.h
index cfe9748a461..a52d6a8ef2d 100644
--- a/llvm/include/llvm/Analysis/DependenceAnalysis.h
+++ b/llvm/include/llvm/Analysis/DependenceAnalysis.h
@@ -287,9 +287,9 @@ namespace llvm {
/// The flag PossiblyLoopIndependent should be set by the caller
/// if it appears that control flow can reach from Src to Dst
/// without traversing a loop back edge.
- Dependence *depends(Instruction *Src,
- Instruction *Dst,
- bool PossiblyLoopIndependent);
+ std::unique_ptr<Dependence> depends(Instruction *Src,
+ Instruction *Dst,
+ bool PossiblyLoopIndependent);
/// getSplitIteration - Give a dependence that's splittable at some
/// particular level, return the iteration that should be used to split
diff --git a/llvm/lib/Analysis/DependenceAnalysis.cpp b/llvm/lib/Analysis/DependenceAnalysis.cpp
index 312081c676c..be4e487a149 100644
--- a/llvm/lib/Analysis/DependenceAnalysis.cpp
+++ b/llvm/lib/Analysis/DependenceAnalysis.cpp
@@ -163,7 +163,7 @@ void dumpExampleDependence(raw_ostream &OS, Function *F,
DstI != DstE; ++DstI) {
if (isa<StoreInst>(*DstI) || isa<LoadInst>(*DstI)) {
OS << "da analyze - ";
- if (Dependence *D = DA->depends(&*SrcI, &*DstI, true)) {
+ if (auto D = DA->depends(&*SrcI, &*DstI, true)) {
D->dump(OS);
for (unsigned Level = 1; Level <= D->getLevels(); Level++) {
if (D->isSplitable(Level)) {
@@ -172,7 +172,6 @@ void dumpExampleDependence(raw_ostream &OS, Function *F,
OS << "!\n";
}
}
- delete D;
}
else
OS << "none!\n";
@@ -3277,9 +3276,9 @@ static void dumpSmallBitVector(SmallBitVector &BV) {
//
// Care is required to keep the routine below, getSplitIteration(),
// up to date with respect to this routine.
-Dependence *DependenceAnalysis::depends(Instruction *Src,
- Instruction *Dst,
- bool PossiblyLoopIndependent) {
+std::unique_ptr<Dependence>
+DependenceAnalysis::depends(Instruction *Src, Instruction *Dst,
+ bool PossiblyLoopIndependent) {
if (Src == Dst)
PossiblyLoopIndependent = false;
@@ -3291,7 +3290,7 @@ Dependence *DependenceAnalysis::depends(Instruction *Src,
if (!isLoadOrStore(Src) || !isLoadOrStore(Dst)) {
// can only analyze simple loads and stores, i.e., no calls, invokes, etc.
DEBUG(dbgs() << "can only handle simple loads and stores\n");
- return new Dependence(Src, Dst);
+ return make_unique<Dependence>(Src, Dst);
}
Value *SrcPtr = getPointerOperand(Src);
@@ -3302,7 +3301,7 @@ Dependence *DependenceAnalysis::depends(Instruction *Src,
case AliasAnalysis::PartialAlias:
// cannot analyse objects if we don't understand their aliasing.
DEBUG(dbgs() << "can't analyze may or partial alias\n");
- return new Dependence(Src, Dst);
+ return make_unique<Dependence>(Src, Dst);
case AliasAnalysis::NoAlias:
// If the objects noalias, they are distinct, accesses are independent.
DEBUG(dbgs() << "no alias\n");
@@ -3675,7 +3674,8 @@ Dependence *DependenceAnalysis::depends(Instruction *Src,
return nullptr;
}
- FullDependence *Final = new FullDependence(Result);
+ std::unique_ptr<Dependence> Final;
+ Final.reset(new FullDependence(Result));
Result.DV = nullptr;
return Final;
}
OpenPOWER on IntegriCloud