[PATCH] D131448: Introduce iterator sentinel to make graph traversal implementation more efficient and cleaner

Roman Rusyaev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 8 15:13:08 PDT 2022


rusyaev-roman created this revision.
Herald added subscribers: mtrofin, carlosgalvezp, ormris, wenlei, okura, jdoerfert, bmahjour, kuter, arphaman, rogfer01, hiraditya.
Herald added a project: All.
rusyaev-roman requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added a reviewer: sstefan1.
Herald added subscribers: cfe-commits, llvm-commits, vkmr.
Herald added projects: LLVM, clang-tools-extra.

As of C++17, for "range-based for loop" the types of the begin-expr and the end-expr do not have to be the same,
and in fact the type of the end-expr does not have to be an iterator. This makes it possible to delimit
a range by a predicate for graph traversal iterators. To be more specific, it's not necessary to comapre
two containers in order to check that an iterator is the end iterator.
For more information see https://en.cppreference.com/w/cpp/language/range-for#Notes


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D131448

Files:
  clang-tools-extra/clang-tidy/misc/NoRecursionCheck.cpp
  llvm/include/llvm/ADT/BreadthFirstIterator.h
  llvm/include/llvm/ADT/DepthFirstIterator.h
  llvm/include/llvm/ADT/PostOrderIterator.h
  llvm/include/llvm/ADT/SCCIterator.h
  llvm/include/llvm/ADT/iterator_range.h
  llvm/lib/Analysis/BlockFrequencyInfoImpl.cpp
  llvm/lib/Analysis/BranchProbabilityInfo.cpp
  llvm/lib/Analysis/CFGPrinter.cpp
  llvm/lib/Analysis/DDG.cpp
  llvm/lib/Analysis/DependenceGraphBuilder.cpp
  llvm/lib/Analysis/GlobalsModRef.cpp
  llvm/lib/Analysis/LoopCacheAnalysis.cpp
  llvm/lib/Analysis/LoopNestAnalysis.cpp
  llvm/lib/Analysis/MLInlineAdvisor.cpp
  llvm/lib/Analysis/SyntheticCountsUtils.cpp
  llvm/lib/IR/ModuleSummaryIndex.cpp
  llvm/lib/Transforms/IPO/AttributorAttributes.cpp
  llvm/lib/Transforms/IPO/FunctionAttrs.cpp
  llvm/lib/Transforms/IPO/SampleProfile.cpp
  llvm/lib/Transforms/Scalar/StructurizeCFG.cpp
  llvm/lib/Transforms/Utils/FixIrreducible.cpp
  llvm/tools/llvm-profgen/CSPreInliner.cpp
  llvm/tools/opt/PrintSCC.cpp
  llvm/unittests/ADT/DirectedGraphTest.cpp
  llvm/unittests/Transforms/Vectorize/VPlanTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131448.450968.patch
Type: text/x-patch
Size: 30254 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220808/7a49e846/attachment-0001.bin>


More information about the cfe-commits mailing list