[llvm] b7ebb67 - [SCEV] Fix -Wrange-loop-construct (NFC)
Jie Fu via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 13 02:13:51 PDT 2024
Author: Jie Fu
Date: 2024-08-13T17:13:04+08:00
New Revision: b7ebb67b86888de05419e07a38b932344ac9c7a7
URL: https://github.com/llvm/llvm-project/commit/b7ebb67b86888de05419e07a38b932344ac9c7a7
DIFF: https://github.com/llvm/llvm-project/commit/b7ebb67b86888de05419e07a38b932344ac9c7a7.diff
LOG: [SCEV] Fix -Wrange-loop-construct (NFC)
/llvm-project/llvm/lib/Analysis/ScalarEvolution.cpp:12009:21:
error: loop variable '[S, Mul]' creates a copy from type 'const value_type' (aka 'const llvm::detail::DenseMapPair<const llvm::SCEV *, int>') [-Werror,-Wrange-loop-construct]
for (const auto [S, Mul] : Multiplicity) {
^
/llvm-project/llvm/lib/Analysis/ScalarEvolution.cpp:12009:10:
note: use reference type 'const value_type &' (aka 'const llvm::detail::DenseMapPair<const llvm::SCEV *, int> &') to prevent copying
for (const auto [S, Mul] : Multiplicity) {
^~~~~~~~~~~~~~~~~~~~~
&
Added:
Modified:
llvm/lib/Analysis/ScalarEvolution.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index 78975bee4d72c..9a568a252f8d2 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -12006,7 +12006,7 @@ ScalarEvolution::computeConstantDifference(const SCEV *More, const SCEV *Less) {
// Check whether all the non-constants cancel out, or reduce to new
// More/Less values.
const SCEV *NewMore = nullptr, *NewLess = nullptr;
- for (const auto [S, Mul] : Multiplicity) {
+ for (const auto &[S, Mul] : Multiplicity) {
if (Mul == 0)
continue;
if (Mul == 1) {
More information about the llvm-commits
mailing list