OSDN Git Service

[SCEV] Make it obvious BackedgeTakenInfo's constructor steals storage
authorSanjoy Das <sanjoy@playingwithpointers.com>
Mon, 26 Sep 2016 01:10:27 +0000 (01:10 +0000)
committerSanjoy Das <sanjoy@playingwithpointers.com>
Mon, 26 Sep 2016 01:10:27 +0000 (01:10 +0000)
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

include/llvm/Analysis/ScalarEvolution.h
lib/Analysis/ScalarEvolution.cpp

index 09f6e8a..c17fa97 100644 (file)
@@ -652,7 +652,7 @@ private:
     typedef std::pair<BasicBlock *, ExitLimit> EdgeExitInfo;
 
     /// Initialize BackedgeTakenInfo from a list of exact exit counts.
-    BackedgeTakenInfo(ArrayRef<EdgeExitInfo> ExitCounts, bool Complete,
+    BackedgeTakenInfo(SmallVectorImpl<EdgeExitInfo> &&ExitCounts, bool Complete,
                       const SCEV *MaxCount);
 
     /// Test whether this BackedgeTakenInfo contains any computed information,
index b6edbb8..602a287 100644 (file)
@@ -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<ScalarEvolution::BackedgeTakenInfo::EdgeExitInfo> ExitCounts,
+    SmallVectorImpl<ScalarEvolution::BackedgeTakenInfo::EdgeExitInfo>
+        &&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