<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Assertion `NumReferences == 0 && "Node deleted while references remain"' with -inline -functionattrs -indvars"
   href="https://bugs.llvm.org/show_bug.cgi?id=38855">38855</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Assertion `NumReferences == 0 && "Node deleted while references remain"' with -inline -functionattrs -indvars
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>mikael.holmen@ericsson.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=20849" name="attach_20849" title="reproducer">attachment 20849</a> <a href="attachment.cgi?id=20849&action=edit" title="reproducer">[details]</a></span>
reproducer

opt -S -o - bbi-17684.ll -inline -functionattrs -indvars 

gives

opt: ../include/llvm/Analysis/CallGraph.h:181:
llvm::CallGraphNode::~CallGraphNode(): Assertion `NumReferences == 0 && "Node
deleted while references remain"' failed.
Stack dump:
0.      Program arguments: build-all/bin/opt -S -o - bbi-17684.ll -inline
-functionattrs -indvars 
1.      Running pass 'CallGraph Pass Manager' on module 'bbi-17684.ll'.
#0 0x0000000001fdd744 PrintStackTraceSignalHandler(void*)
(build-all/bin/opt+0x1fdd744)
#1 0x0000000001fdb990 llvm::sys::RunSignalHandlers()
(build-all/bin/opt+0x1fdb990)
#2 0x0000000001fddaa8 SignalHandler(int) (build-all/bin/opt+0x1fddaa8)
#3 0x00007ff7f0468330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#4 0x00007ff7ef057c37 gsignal
/build/eglibc-ripdx6/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007ff7ef05b028 abort
/build/eglibc-ripdx6/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007ff7ef050bf6 __assert_fail_base
/build/eglibc-ripdx6/eglibc-2.19/assert/assert.c:92:0
#7 0x00007ff7ef050ca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
#8 0x000000000147ac85 (build-all/bin/opt+0x147ac85)
#9 0x000000000147b0c6 std::_Rb_tree<llvm::Function const*,
std::pair<llvm::Function const* const, std::unique_ptr<llvm::CallGraphNode,
std::default_delete<llvm::CallGraphNode> > >,
std::_Select1st<std::pair<llvm::Function const* const,
std::unique_ptr<llvm::CallGraphNode, std::default_delete<llvm::CallGraphNode> >
<span class="quote">> >, std::less<llvm::Function const*>, std::allocator<std::pair<llvm::Function</span >
const* const, std::unique_ptr<llvm::CallGraphNode,
std::default_delete<llvm::CallGraphNode> > > > >::erase(llvm::Function const*
const&) (build-all/bin/opt+0x147b0c6)
#10 0x0000000001479945
llvm::CallGraph::removeFunctionFromModule(llvm::CallGraphNode*)
(build-all/bin/opt+0x1479945)
#11 0x0000000001b3ec3b
llvm::LegacyInlinerBase::removeDeadFunctions(llvm::CallGraph&, bool)
(build-all/bin/opt+0x1b3ec3b)
#12 0x000000000147d656 (anonymous
namespace)::CGPassManager::runOnModule(llvm::Module&)
(build-all/bin/opt+0x147d656)
#13 0x0000000001a6c5ed llvm::legacy::PassManagerImpl::run(llvm::Module&)
(build-all/bin/opt+0x1a6c5ed)
#14 0x000000000074498c main (build-all/bin/opt+0x74498c)
#15 0x00007ff7ef042f45 __libc_start_main
/build/eglibc-ripdx6/eglibc-2.19/csu/libc-start.c:321:0
#16 0x000000000072dced _start (build-all/bin/opt+0x72dced)

This happens on trunk and it's fairly new, it started happening with r334567:

    [SimplifyIndVars] Ignore dead users</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>