[PATCH] D124764: [NFC][GVNSink] Don't pretend that iteration is over instructions when it's actually over blocks
Dawid Jurczak via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 2 06:23:20 PDT 2022
yurai007 updated this revision to Diff 426395.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D124764/new/
https://reviews.llvm.org/D124764
Files:
llvm/lib/Transforms/Scalar/GVNSink.cpp
Index: llvm/lib/Transforms/Scalar/GVNSink.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/GVNSink.cpp
+++ llvm/lib/Transforms/Scalar/GVNSink.cpp
@@ -779,12 +779,9 @@
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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124764.426395.patch
Type: text/x-patch
Size: 707 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220502/5b978c43/attachment.bin>
More information about the llvm-commits
mailing list