[llvm] 9c46a9c - [NFC][GVNSink] Don't pretend that iteration is over instructions when it's actually over blocks
Dawid Jurczak via llvm-commits
llvm-commits at lists.llvm.org
Tue May 3 08:20:47 PDT 2022
Author: Dawid Jurczak
Date: 2022-05-03T17:19:40+02:00
New Revision: 9c46a9cf611f107c34a8616bef7476842e7e5d71
URL: https://github.com/llvm/llvm-project/commit/9c46a9cf611f107c34a8616bef7476842e7e5d71
DIFF: https://github.com/llvm/llvm-project/commit/9c46a9cf611f107c34a8616bef7476842e7e5d71.diff
LOG: [NFC][GVNSink] Don't pretend that iteration is over instructions when it's actually over blocks
Differential Revision: https://reviews.llvm.org/D124764
Added:
Modified:
llvm/lib/Transforms/Scalar/GVNSink.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Scalar/GVNSink.cpp b/llvm/lib/Transforms/Scalar/GVNSink.cpp
index 53380326f3f01..2610ef1a4e1a2 100644
--- a/llvm/lib/Transforms/Scalar/GVNSink.cpp
+++ b/llvm/lib/Transforms/Scalar/GVNSink.cpp
@@ -774,12 +774,9 @@ unsigned GVNSink::sinkBB(BasicBlock *BBEnd) {
unsigned NumOrigPreds = Preds.size();
// We can only sink instructions through unconditional branches.
- for (auto I = Preds.begin(); I != Preds.end();) {
- if ((*I)->getTerminator()->getNumSuccessors() != 1)
- I = Preds.erase(I);
- else
- ++I;
- }
+ llvm::erase_if(Preds, [](BasicBlock *BB) {
+ return BB->getTerminator()->getNumSuccessors() != 1;
+ });
LockstepReverseIterator LRI(Preds);
SmallVector<SinkingInstructionCandidate, 4> Candidates;
More information about the llvm-commits
mailing list