diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ir/local-utils.h | 2 | ||||
-rw-r--r-- | src/passes/CodePushing.cpp | 8 | ||||
-rw-r--r-- | src/passes/LoopInvariantCodeMotion.cpp | 1 | ||||
-rw-r--r-- | src/passes/ReorderLocals.cpp | 6 |
4 files changed, 8 insertions, 9 deletions
diff --git a/src/ir/local-utils.h b/src/ir/local-utils.h index 73d065e73..ef74a35eb 100644 --- a/src/ir/local-utils.h +++ b/src/ir/local-utils.h @@ -31,8 +31,8 @@ struct LocalGetCounter : public PostWalker<LocalGetCounter> { void analyze(Function* func) { analyze(func, func->body); } void analyze(Function* func, Expression* ast) { + num.clear(); num.resize(func->getNumLocals()); - std::fill(num.begin(), num.end(), 0); walk(ast); } diff --git a/src/passes/CodePushing.cpp b/src/passes/CodePushing.cpp index 3ac11eebd..29a3ae743 100644 --- a/src/passes/CodePushing.cpp +++ b/src/passes/CodePushing.cpp @@ -41,12 +41,12 @@ struct LocalAnalyzer : public PostWalker<LocalAnalyzer> { void analyze(Function* func) { auto num = func->getNumLocals(); + numSets.clear(); numSets.resize(num); - std::fill(numSets.begin(), numSets.end(), 0); + numGets.clear(); numGets.resize(num); - std::fill(numGets.begin(), numGets.end(), 0); + sfa.clear(); sfa.resize(num); - std::fill(sfa.begin(), sfa.begin() + func->getNumParams(), false); std::fill(sfa.begin() + func->getNumParams(), sfa.end(), true); walk(func->body); for (Index i = 0; i < num; i++) { @@ -245,8 +245,8 @@ struct CodePushing : public WalkerPass<PostWalker<CodePushing>> { // pre-scan to find which vars are sfa, and also count their gets&sets analyzer.analyze(func); // prepare to walk + numGetsSoFar.clear(); numGetsSoFar.resize(func->getNumLocals()); - std::fill(numGetsSoFar.begin(), numGetsSoFar.end(), 0); // walk and optimize walk(func->body); } diff --git a/src/passes/LoopInvariantCodeMotion.cpp b/src/passes/LoopInvariantCodeMotion.cpp index 7fbd3ef55..c70c8e5fe 100644 --- a/src/passes/LoopInvariantCodeMotion.cpp +++ b/src/passes/LoopInvariantCodeMotion.cpp @@ -75,7 +75,6 @@ struct LoopInvariantCodeMotion // FIXME: also the loop tail issue from above. auto numLocals = getFunction()->getNumLocals(); std::vector<Index> numSetsForIndex(numLocals); - std::fill(numSetsForIndex.begin(), numSetsForIndex.end(), 0); LoopSets loopSets; { FindAll<LocalSet> finder(loop); diff --git a/src/passes/ReorderLocals.cpp b/src/passes/ReorderLocals.cpp index b34eeb3bf..7b2de0d70 100644 --- a/src/passes/ReorderLocals.cpp +++ b/src/passes/ReorderLocals.cpp @@ -50,10 +50,10 @@ struct ReorderLocals : public WalkerPass<PostWalker<ReorderLocals>> { return; // nothing to do. All locals are parameters } Index num = curr->getNumLocals(); + counts.clear(); counts.resize(num); - std::fill(counts.begin(), counts.end(), 0); - firstUses.resize(num); - std::fill(firstUses.begin(), firstUses.end(), Unseen); + firstUses.clear(); + firstUses.resize(num, Unseen); // Gather information about local usages. walk(curr->body); // Use the information about local usages. |