[llvm] r207750 - [LCG] Don't lookup the child SCC twice. Spotted this by inspection, and

David Blaikie dblaikie at gmail.com
Thu May 1 10:21:10 PDT 2014


On Thu, May 1, 2014 at 5:16 AM, Chandler Carruth <chandlerc at gmail.com> wrote:
> Author: chandlerc
> Date: Thu May  1 07:16:31 2014
> New Revision: 207750
>
> URL: http://llvm.org/viewvc/llvm-project?rev=207750&view=rev
> Log:
> [LCG] Don't lookup the child SCC twice. Spotted this by inspection, and
> no functionality changed.
>
> Modified:
>     llvm/trunk/lib/Analysis/LazyCallGraph.cpp
>
> Modified: llvm/trunk/lib/Analysis/LazyCallGraph.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LazyCallGraph.cpp?rev=207750&r1=207749&r2=207750&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Analysis/LazyCallGraph.cpp (original)
> +++ llvm/trunk/lib/Analysis/LazyCallGraph.cpp Thu May  1 07:16:31 2014
> @@ -463,9 +463,9 @@ LazyCallGraph::SCC *LazyCallGraph::formS
>    bool IsLeafSCC = true;
>    for (Node *SCCN : NewSCC->Nodes)
>      for (Node &SCCChildN : *SCCN) {
> -      if (SCCMap.lookup(&SCCChildN) == NewSCC)
> -        continue;
>        SCC &ChildSCC = *SCCMap.lookup(&SCCChildN);

I take it you have an invariant that this element exists in the map,
then? (lookup returns a null pointer if it doesn't)

> +      if (&ChildSCC == NewSCC)
> +        continue;
>        ChildSCC.ParentSCCs.insert(NewSCC);
>        IsLeafSCC = false;
>      }
>
>
> _______________________________________________
> 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