aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2024-05-12 23:02:37 -0700
committerKazu Hirata <kazu@google.com>2024-05-12 23:02:37 -0700
commite6785fd75284f53b9e23db6f249598e09f3fc39f (patch)
tree2011444ba8f2201f1f4601dfdfa39337793af40f
parent662267daea7e76ee3cee90c63ab2bc2964b77b76 (diff)
downloadllvm-e6785fd75284f53b9e23db6f249598e09f3fc39f.zip
llvm-e6785fd75284f53b9e23db6f249598e09f3fc39f.tar.gz
llvm-e6785fd75284f53b9e23db6f249598e09f3fc39f.tar.bz2
[Scalar] Fix a warning
This patch fixes: llvm/lib/Transforms/Scalar/GVNSink.cpp:270:33: error: lambda capture 'this' is not used [-Werror,-Wunused-lambda-capture] While I am at it, this patch replaces llvm::for_each with a range-based for loop.
-rw-r--r--llvm/lib/Transforms/Scalar/GVNSink.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/GVNSink.cpp b/llvm/lib/Transforms/Scalar/GVNSink.cpp
index ddf01dc..95a4c64 100644
--- a/llvm/lib/Transforms/Scalar/GVNSink.cpp
+++ b/llvm/lib/Transforms/Scalar/GVNSink.cpp
@@ -267,13 +267,13 @@ public:
};
assert(llvm::is_sorted(Blocks, ComesBefore));
int C = 0;
- llvm::for_each(Values, [&C, this](const Value *V) {
+ for (const Value *V : Values) {
if (!isa<UndefValue>(V)) {
- const Instruction *I = cast<Instruction>(V);
- assert(I->getParent() == this->Blocks[C]);
+ assert(cast<Instruction>(V)->getParent() == Blocks[C]);
+ (void)C;
}
C++;
- });
+ }
}
/// Create a PHI from an array of incoming values and incoming blocks.
ModelledPHI(SmallVectorImpl<Instruction *> &V,