[ADT] Actually mutate the iterator VisitStack.back().second, not its copy.
authorTim Shen <timshen91@gmail.com>
Mon, 22 Aug 2016 21:59:26 +0000 (21:59 +0000)
committerTim Shen <timshen91@gmail.com>
Mon, 22 Aug 2016 21:59:26 +0000 (21:59 +0000)
commit608ca2504ac1865227e892dee2af4bd64870dc31
tree7e344a20e634149102bc18d3003fbd65853da2d4
parent25f02cfc52c7adfa76a45bc6a8063a675a5e6c5d
[ADT] Actually mutate the iterator VisitStack.back().second, not its copy.

Summary: Before the change, *Opt never actually gets updated by the end
of toNext(), so for every next time the loop has to start over from
child_begin(). This bug doesn't affect the correctness, since Visited prevents
it from re-entering the same node again; but it's slow.

Reviewers: dberris, dblaikie, dannyb

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D23649

llvm-svn: 279482
llvm/include/llvm/ADT/DepthFirstIterator.h
llvm/unittests/ADT/CMakeLists.txt
llvm/unittests/ADT/DepthFirstIteratorTest.cpp [new file with mode: 0644]
llvm/unittests/ADT/SCCIteratorTest.cpp
llvm/unittests/ADT/TestGraph.h [new file with mode: 0644]