From: Sanjoy Das Date: Mon, 26 Sep 2016 01:10:27 +0000 (+0000) Subject: [SCEV] Make it obvious BackedgeTakenInfo's constructor steals storage X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=98e898ce469aebf3236321941ef7d2de8d3cd801;p=llvm [SCEV] Make it obvious BackedgeTakenInfo's constructor steals storage Specifically, it moves SCEVUnionPredicates from its input into its own storage. Make this obvious at the type level. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282374 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Analysis/ScalarEvolution.h b/include/llvm/Analysis/ScalarEvolution.h index 09f6e8aa2c8..c17fa97ef5f 100644 --- a/include/llvm/Analysis/ScalarEvolution.h +++ b/include/llvm/Analysis/ScalarEvolution.h @@ -652,7 +652,7 @@ private: typedef std::pair EdgeExitInfo; /// Initialize BackedgeTakenInfo from a list of exact exit counts. - BackedgeTakenInfo(ArrayRef ExitCounts, bool Complete, + BackedgeTakenInfo(SmallVectorImpl &&ExitCounts, bool Complete, const SCEV *MaxCount); /// Test whether this BackedgeTakenInfo contains any computed information, diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index b6edbb8e974..602a287dcbc 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -5667,7 +5667,8 @@ bool ScalarEvolution::BackedgeTakenInfo::hasOperand(const SCEV *S, /// Allocate memory for BackedgeTakenInfo and copy the not-taken count of each /// computable exit into a persistent ExitNotTakenInfo array. ScalarEvolution::BackedgeTakenInfo::BackedgeTakenInfo( - ArrayRef ExitCounts, + SmallVectorImpl + &&ExitCounts, bool Complete, const SCEV *MaxCount) : MaxAndComplete(MaxCount, Complete) { typedef ScalarEvolution::BackedgeTakenInfo::EdgeExitInfo EdgeExitInfo; @@ -5753,7 +5754,8 @@ ScalarEvolution::computeBackedgeTakenCount(const Loop *L, } const SCEV *MaxBECount = MustExitMaxBECount ? MustExitMaxBECount : (MayExitMaxBECount ? MayExitMaxBECount : getCouldNotCompute()); - return BackedgeTakenInfo(ExitCounts, CouldComputeBECount, MaxBECount); + return BackedgeTakenInfo(std::move(ExitCounts), CouldComputeBECount, + MaxBECount); } ScalarEvolution::ExitLimit