From: Chandler Carruth Date: Fri, 13 Feb 2015 02:10:56 +0000 (+0000) Subject: [unroll] Tidy up the integer we use to accumululate the number of X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=6636106c277308a590e5afb862066b62bb9aa395;p=oota-llvm.git [unroll] Tidy up the integer we use to accumululate the number of instructions optimized. NFC, just separating this out from the functionality changing commit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229026 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Scalar/LoopUnrollPass.cpp b/lib/Transforms/Scalar/LoopUnrollPass.cpp index feebf1aede9..5586032b742 100644 --- a/lib/Transforms/Scalar/LoopUnrollPass.cpp +++ b/lib/Transforms/Scalar/LoopUnrollPass.cpp @@ -330,12 +330,14 @@ class UnrollAnalyzer : public InstVisitor { unsigned TripCount; ScalarEvolution &SE; const TargetTransformInfo &TTI; - unsigned NumberOfOptimizedInstructions; DenseMap SimplifiedValues; DenseMap LoadBaseAddresses; SmallPtrSet CountedInsns; + /// \brief Count the number of optimized instructions. + unsigned NumberOfOptimizedInstructions; + // Provide base case for our instruction visit. bool visitInstruction(Instruction &I) { return false; }; // TODO: We should also visit ICmp, FCmp, GetElementPtr, Trunc, ZExt, SExt, @@ -456,8 +458,8 @@ public: SmallVector Worklist; SimplifiedValues.clear(); CountedInsns.clear(); - NumberOfOptimizedInstructions = 0; + // We start by adding all loads to the worklist. for (auto LoadDescr : LoadBaseAddresses) { LoadInst *LI = LoadDescr.first; @@ -500,6 +502,7 @@ public: NumberOfOptimizedInstructions = 0; SmallVector Worklist; SmallPtrSet DeadInstructions; + // Start by initializing worklist with simplified instructions. for (auto Folded : SimplifiedValues) { if (auto FoldedInsn = dyn_cast(Folded.first)) {