[llvm] r207086 - [LCG] Switch the SCC's parent iterators to be value iterators rather

David Blaikie dblaikie at gmail.com
Thu Apr 24 07:35:41 PDT 2014


On Thu, Apr 24, 2014 at 12:48 AM, Chandler Carruth <chandlerc at gmail.com> wrote:
> Author: chandlerc
> Date: Thu Apr 24 02:48:18 2014
> New Revision: 207086
>
> URL: http://llvm.org/viewvc/llvm-project?rev=207086&view=rev
> Log:
> [LCG] Switch the SCC's parent iterators to be value iterators rather
> than pointer iterators.

Nice - yeah, we have so many sequences of non-null pointers (either
because they're non-owning, polymorphic, or both) that would be rather
nice to iterate over as values like this.

>
> Modified:
>     llvm/trunk/include/llvm/Analysis/LazyCallGraph.h
>     llvm/trunk/unittests/Analysis/LazyCallGraphTest.cpp
>
> Modified: llvm/trunk/include/llvm/Analysis/LazyCallGraph.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LazyCallGraph.h?rev=207086&r1=207085&r2=207086&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/Analysis/LazyCallGraph.h (original)
> +++ llvm/trunk/include/llvm/Analysis/LazyCallGraph.h Thu Apr 24 02:48:18 2014
> @@ -41,6 +41,7 @@
>  #include "llvm/ADT/SetVector.h"
>  #include "llvm/ADT/SmallPtrSet.h"
>  #include "llvm/ADT/SmallVector.h"
> +#include "llvm/ADT/iterator.h"
>  #include "llvm/ADT/iterator_range.h"
>  #include "llvm/IR/BasicBlock.h"
>  #include "llvm/IR/Function.h"
> @@ -228,7 +229,7 @@ public:
>
>    public:
>      typedef SmallVectorImpl<Node *>::const_iterator iterator;
> -    typedef SmallSetVector<SCC *, 1>::const_iterator parent_iterator;
> +    typedef pointee_iterator<SmallSetVector<SCC *, 1>::const_iterator> parent_iterator;
>
>      iterator begin() const { return Nodes.begin(); }
>      iterator end() const { return Nodes.end(); }
>
> Modified: llvm/trunk/unittests/Analysis/LazyCallGraphTest.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Analysis/LazyCallGraphTest.cpp?rev=207086&r1=207085&r2=207086&view=diff
> ==============================================================================
> --- llvm/trunk/unittests/Analysis/LazyCallGraphTest.cpp (original)
> +++ llvm/trunk/unittests/Analysis/LazyCallGraphTest.cpp Thu Apr 24 02:48:18 2014
> @@ -329,7 +329,7 @@ TEST(LazyCallGraphTest, InterSCCEdgeRemo
>
>    EXPECT_EQ("b", A.begin()->getFunction().getName());
>    EXPECT_EQ(B.end(), B.begin());
> -  EXPECT_EQ(&AC, *BC.parent_begin());
> +  EXPECT_EQ(&AC, &*BC.parent_begin());
>
>    CG.removeEdge(A, lookupFunction(*M, "b"));
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list