[llvm] r280570 - ADT: Do not inherit from std::iterator in ilist_iterator
Duncan P. N. Exon Smith via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 2 19:27:35 PDT 2016
Author: dexonsmith
Date: Fri Sep 2 21:27:35 2016
New Revision: 280570
URL: http://llvm.org/viewvc/llvm-project?rev=280570&view=rev
Log:
ADT: Do not inherit from std::iterator in ilist_iterator
Inheriting from std::iterator uses more boiler-plate than manual
typedefs. Avoid that in both ilist_iterator and
MachineInstrBundleIterator.
This has the side effect of removing ilist_iterator from certain ADL
lookups in namespace std; calls to std::next need to be qualified by
"std::" that didn't have to before. The one case of this in-tree was
operating on a temporary, so I used the more compact operator++.
Modified:
llvm/trunk/include/llvm/ADT/ilist_iterator.h
llvm/trunk/include/llvm/CodeGen/MachineInstrBundleIterator.h
llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp
Modified: llvm/trunk/include/llvm/ADT/ilist_iterator.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ilist_iterator.h?rev=280570&r1=280569&r2=280570&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/ilist_iterator.h (original)
+++ llvm/trunk/include/llvm/ADT/ilist_iterator.h Fri Sep 2 21:27:35 2016
@@ -47,17 +47,13 @@ template <> struct IteratorHelper<true>
} // end namespace ilist_detail
/// Iterator for intrusive lists based on ilist_node.
-template <typename NodeTy, bool IsReverse>
-class ilist_iterator
- : public std::iterator<std::bidirectional_iterator_tag, NodeTy, ptrdiff_t> {
+template <typename NodeTy, bool IsReverse> class ilist_iterator {
public:
- typedef std::iterator<std::bidirectional_iterator_tag, NodeTy, ptrdiff_t>
- super;
-
- typedef typename super::value_type value_type;
- typedef typename super::difference_type difference_type;
- typedef typename super::pointer pointer;
- typedef typename super::reference reference;
+ typedef NodeTy value_type;
+ typedef value_type *pointer;
+ typedef value_type &reference;
+ typedef ptrdiff_t difference_type;
+ typedef std::bidirectional_iterator_tag iterator_category;
typedef typename std::add_const<value_type>::type *const_pointer;
typedef typename std::add_const<value_type>::type &const_reference;
Modified: llvm/trunk/include/llvm/CodeGen/MachineInstrBundleIterator.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineInstrBundleIterator.h?rev=280570&r1=280569&r2=280570&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineInstrBundleIterator.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineInstrBundleIterator.h Fri Sep 2 21:27:35 2016
@@ -21,18 +21,16 @@ namespace llvm {
/// MachineBasicBlock iterator that automatically skips over MIs that are
/// inside bundles (i.e. walk top level MIs only).
-template <typename Ty>
-class MachineInstrBundleIterator
- : public std::iterator<std::bidirectional_iterator_tag, Ty, ptrdiff_t> {
- typedef std::iterator<std::bidirectional_iterator_tag, Ty, ptrdiff_t> super;
+template <typename Ty> class MachineInstrBundleIterator {
typedef ilist_iterator<Ty> instr_iterator;
instr_iterator MII;
public:
- typedef typename super::value_type value_type;
- typedef typename super::difference_type difference_type;
- typedef typename super::pointer pointer;
- typedef typename super::reference reference;
+ typedef typename instr_iterator::value_type value_type;
+ typedef typename instr_iterator::difference_type difference_type;
+ typedef typename instr_iterator::pointer pointer;
+ typedef typename instr_iterator::reference reference;
+ typedef std::bidirectional_iterator_tag iterator_category;
typedef typename instr_iterator::const_pointer const_pointer;
typedef typename instr_iterator::const_reference const_reference;
Modified: llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp?rev=280570&r1=280569&r2=280570&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp Fri Sep 2 21:27:35 2016
@@ -2226,7 +2226,7 @@ void BoUpSLP::setInsertPointAfterBundle(
// Set the insertion point after the last instruction in the bundle. Set the
// debug location to Front.
- Builder.SetInsertPoint(BB, next(BasicBlock::iterator(LastInst)));
+ Builder.SetInsertPoint(BB, ++LastInst->getIterator());
Builder.SetCurrentDebugLocation(Front->getDebugLoc());
}
More information about the llvm-commits
mailing list