[llvm] r282374 - [SCEV] Make it obvious BackedgeTakenInfo's constructor steals storage

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 25 18:10:28 PDT 2016


Author: sanjoy
Date: Sun Sep 25 20:10:27 2016
New Revision: 282374

URL: http://llvm.org/viewvc/llvm-project?rev=282374&view=rev
Log:
[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.

Modified:
    llvm/trunk/include/llvm/Analysis/ScalarEvolution.h
    llvm/trunk/lib/Analysis/ScalarEvolution.cpp

Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolution.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ScalarEvolution.h?rev=282374&r1=282373&r2=282374&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/ScalarEvolution.h (original)
+++ llvm/trunk/include/llvm/Analysis/ScalarEvolution.h Sun Sep 25 20:10:27 2016
@@ -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,

Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=282374&r1=282373&r2=282374&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Sun Sep 25 20:10:27 2016
@@ -5667,7 +5667,8 @@ bool ScalarEvolution::BackedgeTakenInfo:
 /// 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::computeBackedgeTakenCou
   }
   const SCEV *MaxBECount = MustExitMaxBECount ? MustExitMaxBECount :
     (MayExitMaxBECount ? MayExitMaxBECount : getCouldNotCompute());
-  return BackedgeTakenInfo(ExitCounts, CouldComputeBECount, MaxBECount);
+  return BackedgeTakenInfo(std::move(ExitCounts), CouldComputeBECount,
+                           MaxBECount);
 }
 
 ScalarEvolution::ExitLimit




More information about the llvm-commits mailing list