[PATCH] D139335: [BOLT] Fix blocks layout reverse iterators
Vladislav Khmelevsky via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 8 02:50:04 PST 2022
yota9 updated this revision to Diff 481220.
yota9 added a comment.
Fix iterator types
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D139335/new/
https://reviews.llvm.org/D139335
Files:
bolt/include/bolt/Core/FunctionLayout.h
Index: bolt/include/bolt/Core/FunctionLayout.h
===================================================================
--- bolt/include/bolt/Core/FunctionLayout.h
+++ bolt/include/bolt/Core/FunctionLayout.h
@@ -71,11 +71,8 @@
using FragmentListType = SmallVector<unsigned, 0>;
public:
- using iterator = raw_pointer_iterator<BasicBlockListType::const_iterator,
- BinaryBasicBlock>;
- using const_iterator =
- raw_pointer_iterator<BasicBlockListType::const_iterator,
- const BinaryBasicBlock>;
+ using iterator = BasicBlockListType::iterator;
+ using const_iterator = BasicBlockListType::const_iterator;
private:
FunctionLayout *Layout;
@@ -150,9 +147,7 @@
pointee_iterator<FragmentListType::const_iterator,
const FunctionFragment>;
using block_iterator = BasicBlockListType::iterator;
- using block_const_iterator =
- raw_pointer_iterator<BasicBlockListType::const_iterator,
- const BinaryBasicBlock>;
+ using block_const_iterator = BasicBlockListType::const_iterator;
using block_reverse_iterator = std::reverse_iterator<block_iterator>;
using block_const_reverse_iterator =
std::reverse_iterator<block_const_iterator>;
@@ -303,16 +298,18 @@
return {block_begin(), block_end()};
}
block_reverse_iterator block_rbegin() {
- return block_reverse_iterator(block_end());
+ return block_reverse_iterator(Blocks.rbegin());
}
block_const_reverse_iterator block_rbegin() const {
- return block_const_reverse_iterator(block_end());
+ return block_const_reverse_iterator(
+ std::make_reverse_iterator(block_end()));
}
block_reverse_iterator block_rend() {
- return block_reverse_iterator(block_begin());
+ return block_reverse_iterator(Blocks.rend());
}
block_const_reverse_iterator block_rend() const {
- return block_const_reverse_iterator(block_begin());
+ return block_const_reverse_iterator(
+ std::make_reverse_iterator(block_begin()));
}
iterator_range<block_const_reverse_iterator> rblocks() const {
return {block_rbegin(), block_rend()};
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139335.481220.patch
Type: text/x-patch
Size: 2178 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221208/bad90256/attachment.bin>
More information about the llvm-commits
mailing list