[llvm] r229026 - [unroll] Tidy up the integer we use to accumululate the number of
Chandler Carruth
chandlerc at gmail.com
Thu Feb 12 18:10:56 PST 2015
Author: chandlerc
Date: Thu Feb 12 20:10:56 2015
New Revision: 229026
URL: http://llvm.org/viewvc/llvm-project?rev=229026&view=rev
Log:
[unroll] Tidy up the integer we use to accumululate the number of
instructions optimized. NFC, just separating this out from the
functionality changing commit.
Modified:
llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp?rev=229026&r1=229025&r2=229026&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp Thu Feb 12 20:10:56 2015
@@ -330,12 +330,14 @@ class UnrollAnalyzer : public InstVisito
unsigned TripCount;
ScalarEvolution &SE;
const TargetTransformInfo &TTI;
- unsigned NumberOfOptimizedInstructions;
DenseMap<Value *, Constant *> SimplifiedValues;
DenseMap<LoadInst *, Value *> LoadBaseAddresses;
SmallPtrSet<Instruction *, 32> 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<Instruction *, 8> 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<Instruction *, 8> Worklist;
SmallPtrSet<Instruction *, 16> DeadInstructions;
+
// Start by initializing worklist with simplified instructions.
for (auto Folded : SimplifiedValues) {
if (auto FoldedInsn = dyn_cast<Instruction>(Folded.first)) {
More information about the llvm-commits
mailing list