[polly] r217507 - Use "const auto &" in range based for loops
Tobias Grosser
tobias at grosser.es
Wed Sep 10 07:42:06 PDT 2014
Author: grosser
Date: Wed Sep 10 09:42:06 2014
New Revision: 217507
URL: http://llvm.org/viewvc/llvm-project?rev=217507&view=rev
Log:
Use "const auto &" in range based for loops
This previous code added in r216842 most likely created unnecessary copies.
Reported-by: Duncan P. N. Exon Smith <dexonsmith at apple.com>
Modified:
polly/trunk/lib/CodeGen/CodeGeneration.cpp
Modified: polly/trunk/lib/CodeGen/CodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/CodeGeneration.cpp?rev=217507&r1=217506&r2=217507&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/CodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGen/CodeGeneration.cpp Wed Sep 10 09:42:06 2014
@@ -488,7 +488,7 @@ void ClastStmtCodeGen::codegen(const cla
// Copy the current value map into all vector maps if the key wasn't
// available yet. This is needed in case vector codegen is performed in
// OpenMP subfunctions.
- for (auto KV : ValueMap)
+ for (const auto &KV : ValueMap)
for (int i = 0; i < VectorDimensions; ++i)
VectorMap[i].insert(KV);
@@ -561,7 +561,7 @@ SetVector<Value *> ClastStmtCodeGen::get
SetVector<Value *> Values;
// The clast variables
- for (auto I : ClastVars)
+ for (const auto &I : ClastVars)
Values.insert(I.second);
// Find the temporaries that are referenced in the clast statements'
@@ -583,12 +583,12 @@ void
ClastStmtCodeGen::updateWithValueMap(OMPGenerator::ValueToValueMapTy &VMap) {
std::set<Value *> Inserted;
- for (auto I : ClastVars) {
+ for (const auto &I : ClastVars) {
ClastVars[I.first] = VMap[I.second];
Inserted.insert(I.second);
}
- for (auto I : VMap) {
+ for (const auto &I : VMap) {
if (Inserted.count(I.first))
continue;
@@ -1060,7 +1060,7 @@ public:
}
virtual void printScop(raw_ostream &OS) const {
- for (auto PI : ParallelLoops)
+ for (const auto &PI : ParallelLoops)
OS << "Parallel loop with iterator '" << PI << "' generated\n";
}
More information about the llvm-commits
mailing list