Skip to content

Commit

Permalink
Analysis: unique_ptr-ify DependenceAnalysis::depends
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216357 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
nobled committed Aug 25, 2014
1 parent 75129f6 commit fe2cc2d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions include/llvm/Analysis/DependenceAnalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions lib/Analysis/DependenceAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -172,7 +172,6 @@ void dumpExampleDependence(raw_ostream &OS, Function *F,
OS << "!\n";
}
}
delete D;
}
else
OS << "none!\n";
Expand Down Expand Up @@ -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;

Expand All @@ -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);
Expand All @@ -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");
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit fe2cc2d

Please sign in to comment.