From 040b1baf1d96f81f92827f22884ad1dc4cd0948f Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Wed, 9 Jun 2021 09:08:54 -0700 Subject: [PATCH] Fix range-loop-analysis warning ``` llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:8024:19: warning: loop variable 'VF' of type 'const llvm::ElementCount' creates a copy from type 'const llvm::ElementCount' [-Wrange-loop-analysis] for (const auto VF : VFCandidates) { ^ llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:8024:8: note: use reference type 'const llvm::ElementCount &' to prevent copying for (const auto VF : VFCandidates) { ^~~~~~~~~~~~~~~ & 1 warning generated. ``` Differential Revision: https://reviews.llvm.org/D103970 --- lib/Transforms/Vectorize/LoopVectorize.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Transforms/Vectorize/LoopVectorize.cpp b/lib/Transforms/Vectorize/LoopVectorize.cpp index 82b9642348d..bc745c0765d 100644 --- a/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -8021,7 +8021,7 @@ LoopVectorizationPlanner::plan(ElementCount UserVF, unsigned UserIC) { ElementCount::isKnownLE(VF, MaxFactors.ScalableVF); VF *= 2) VFCandidates.insert(VF); - for (const auto VF : VFCandidates) { + for (const auto &VF : VFCandidates) { // Collect Uniform and Scalar instructions after vectorization with VF. CM.collectUniformsAndScalars(VF);