Skip to content

Commit

Permalink
[SCEV] Fix -Wrange-loop-construct (NFC)
Browse files Browse the repository at this point in the history
/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) {
         ^~~~~~~~~~~~~~~~~~~~~
                    &
  • Loading branch information
DamonFool committed Aug 13, 2024
1 parent e0ad56b commit b7ebb67
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion llvm/lib/Analysis/ScalarEvolution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit b7ebb67

Please sign in to comment.