[llvm-commits] [llvm] r80760 - /llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp

Daniel Dunbar daniel at zuster.org
Thu Sep 3 14:54:30 PDT 2009


There seems to still be an expensive checks failure in this code, the
clang test suite triggers this failure:
--
(gdb) r
Starting program:
/mnt/data/home/ddunbar/llvm/Debug+Checks/bin/clang-cc
/mnt/data/home/ddunbar/llvm/tools/clang/test/CodeGen/parameter-passing.c
-triple i386-unknown-unknown -O3 -emit-llvm -o
/mnt/data/home/ddunbar/llvm/tools/clang/test/Output/CodeGen/parameter-passing.c.tmp
[Thread debugging using libthread_db enabled]
/usr/include/c++/4.3/debug/safe_iterator.h:433:error: attempt to compare a
    singular iterator to a past-the-end iterator.

Objects involved in the operation:
iterator "lhs" @ 0x0x99f1720 {
type = N11__gnu_debug14_Safe_iteratorIN9__gnu_cxx17__normal_iteratorIPSt4pairIN4llvm6WeakVHEPNS4_13CallGraphNodeEENSt6__norm6vectorIS8_SaIS8_EEEEENSt7__debug6vectorIS8_SC_EEEE
(mutable iterator);
  state = singular;
  references sequence with type
`NSt7__debug6vectorISt4pairIN4llvm6WeakVHEPNS2_13CallGraphNodeEESaIS6_EEE'
@ 0x0x99f1720
}
iterator "rhs" @ 0x0xbf8389f0 {
type = N11__gnu_debug14_Safe_iteratorIN9__gnu_cxx17__normal_iteratorIPSt4pairIN4llvm6WeakVHEPNS4_13CallGraphNodeEENSt6__norm6vectorIS8_SaIS8_EEEEENSt7__debug6vectorIS8_SC_EEEE
(mutable iterator);
  state = past-the-end;
  references sequence with type
`NSt7__debug6vectorISt4pairIN4llvm6WeakVHEPNS2_13CallGraphNodeEESaIS6_EEE'
@ 0x0xbf8389f0
}
[New Thread 0xb7d636d0 (LWP 10071)]

Program received signal SIGABRT, Aborted.
[Switching to Thread 0xb7d636d0 (LWP 10071)]
0xb801c430 in __kernel_vsyscall ()
(gdb) bt
#0  0xb801c430 in __kernel_vsyscall ()
#1  0xb7d906d0 in raise () from /lib/tls/i686/cmov/libc.so.6
#2  0xb7d92098 in abort () from /lib/tls/i686/cmov/libc.so.6
#3  0xb7f4d7d9 in __gnu_debug::_Error_formatter::_M_error () from
/usr/lib/libstdc++.so.6
#4  0x086aa397 in
__gnu_debug::operator==<__gnu_cxx::__normal_iterator<std::pair<llvm::WeakVH,
llvm::CallGraphNode*>*, std::__norm::vector<std::pair<llvm::WeakVH,
llvm::CallGraphNode*>, std::allocator<std::pair<llvm::WeakVH,
llvm::CallGraphNode*> > > >,
std::__debug::vector<std::pair<llvm::WeakVH, llvm::CallGraphNode*>,
std::allocator<std::pair<llvm::WeakVH, llvm::CallGraphNode*> > > >
(__lhs=@0x99f1720, __rhs=@0xbf8389f0) at
/usr/include/c++/4.3/debug/safe_iterator.h:430
#5  0x08db7394 in
llvm::mapped_iterator<__gnu_debug::_Safe_iterator<__gnu_cxx::__normal_iterator<std::pair<llvm::WeakVH,
llvm::CallGraphNode*>*, std::__norm::vector<std::pair<llvm::WeakVH,
llvm::CallGraphNode*>, std::allocator<std::pair<llvm::WeakVH,
llvm::CallGraphNode*> > > >,
std::__debug::vector<std::pair<llvm::WeakVH, llvm::CallGraphNode*>,
std::allocator<std::pair<llvm::WeakVH, llvm::CallGraphNode*> > > >,
std::pointer_to_unary_function<std::pair<llvm::WeakVH,
llvm::CallGraphNode*>, llvm::CallGraphNode*> >::operator==
(this=0x99f1720, X=@0xbf8389f0) at
/mnt/data/home/ddunbar/llvm/include/llvm/ADT/STLExtras.h:109
#6  0x08db73be in
llvm::mapped_iterator<__gnu_debug::_Safe_iterator<__gnu_cxx::__normal_iterator<std::pair<llvm::WeakVH,
llvm::CallGraphNode*>*, std::__norm::vector<std::pair<llvm::WeakVH,
llvm::CallGraphNode*>, std::allocator<std::pair<llvm::WeakVH,
llvm::CallGraphNode*> > > >,
std::__debug::vector<std::pair<llvm::WeakVH, llvm::CallGraphNode*>,
std::allocator<std::pair<llvm::WeakVH, llvm::CallGraphNode*> > > >,
std::pointer_to_unary_function<std::pair<llvm::WeakVH,
llvm::CallGraphNode*>, llvm::CallGraphNode*> >::operator!=
(this=0x99f1720, X=@0xbf8389f0) at
/mnt/data/home/ddunbar/llvm/include/llvm/ADT/STLExtras.h:108
#7  0x08dbbe12 in llvm::scc_iterator<llvm::CallGraph*,
llvm::GraphTraits<llvm::CallGraph*> >::DFSVisitChildren
(this=0xbf838b40) at
/mnt/data/home/ddunbar/llvm/include/llvm/ADT/SCCIterator.h:82
#8  0x08dbbead in llvm::scc_iterator<llvm::CallGraph*,
llvm::GraphTraits<llvm::CallGraph*> >::GetNextSCC (this=0xbf838b40) at
/mnt/data/home/ddunbar/llvm/include/llvm/ADT/SCCIterator.h:101
#9  0x08dbc233 in llvm::scc_iterator<llvm::CallGraph*,
llvm::GraphTraits<llvm::CallGraph*> >::operator++ (this=0xbf838b40) at
/mnt/data/home/ddunbar/llvm/include/llvm/ADT/SCCIterator.h:155
#10 0x08db18c3 in runOnModule (this=0x99fe008, M=@0x99d7660) at
CallGraphSCCPass.cpp:303
#11 0x08ef6919 in llvm::MPPassManager::runOnModule (this=0x99fa148,
M=@0x99d7660) at PassManager.cpp:1447
#12 0x08ef8c3c in llvm::PassManagerImpl::run (this=0x99f8b08,
M=@0x99d7660) at PassManager.cpp:1528
#13 0x08ef8ca1 in llvm::PassManager::run (this=0x99f69e8,
M=@0x99d7660) at PassManager.cpp:1557
#14 0x080c78e9 in EmitAssembly (this=0x99d73e8) at Backend.cpp:350
#15 0x080c7a96 in HandleTranslationUnit (this=0x99d73e8, C=@0x99d8778)
at Backend.cpp:149
#16 0x083b8c93 in clang::ParseAST (PP=@0x99bcee0, Consumer=0x99d73e8,
Ctx=@0x99d8778, PrintStats=false, CompleteTranslationUnit=true) at
ParseAST.cpp:79
#17 0x08099c97 in ProcessInputFile (PP=@0x99bcee0, PPF=@0xbf8396f4,
InFile=@0x99b9080, PA=EmitLLVM, Features=@0xbf83970c,
Context=@0x99b66f8) at clang-cc.cpp:2084
#18 0x0809b72d in main (argc=8, argv=0xbf8399c4) at clang-cc.cpp:2355
(gdb)
--

This was working not too long ago.

Can you take a look?

 - Daniel

On Tue, Sep 1, 2009 at 9:39 PM, Chris Lattner<sabre at nondot.org> wrote:
> Author: lattner
> Date: Tue Sep  1 23:39:04 2009
> New Revision: 80760
>
> URL: http://llvm.org/viewvc/llvm-project?rev=80760&view=rev
> Log:
> revert my patch, duncan points out what is wrong with my logic.  Add
> a comment so that I don't change this in the future :)
>
> Modified:
>    llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp
>
> Modified: llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp?rev=80760&r1=80759&r2=80760&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp (original)
> +++ llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Tue Sep  1 23:39:04 2009
> @@ -177,12 +177,16 @@
>         assert(!CheckingMode &&
>                "CallGraphSCCPass did not update the CallGraph correctly!");
>
> -        // Just remove the edge from the set of callees.
> +        // Just remove the edge from the set of callees, keep track of whether
> +        // I points to the last element of the vector.
> +        bool WasLast = I + 1 == E;
>         CGN->removeCallEdge(I);
>
> -        // If we removed the last edge, get out of the loop.
> -        if (CGN->empty()) break;
> -
> +        // If I pointed to the last element of the vector, we have to bail out:
> +        // iterator checking rejects comparisons of the resultant pointer with
> +        // end.
> +        if (WasLast)
> +          break;
>         E = CGN->end();
>         continue;
>       }
>
>
> _______________________________________________
> 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