[llvm-bugs] [Bug 30784] New: Reassociate removes call but preserves CG, asserts

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Oct 25 07:09:12 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=30784

            Bug ID: 30784
           Summary: Reassociate removes call but preserves CG, asserts
           Product: tools
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: opt
          Assignee: unassignedbugs at nondot.org
          Reporter: jesper.antonsson at ericsson.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 17486
  --> https://llvm.org/bugs/attachment.cgi?id=17486&action=edit
Reduced ll file exposing the bug

The reassociate pass may remove a call and then falsely claim to preserve the
CG. This later leads to this assert at dead function removal:

opt: ../include/llvm/Analysis/CallGraph.h:184:
llvm::CallGraphNode::~CallGraphNode(): Assertion `NumReferences == 0 && "Node
deleted while references remain"' failed.

One simple fix is to set the variable MadeChange to true in
RecursivelyEraseDeadInsts() if operating on a CallInst. (However, the
preservation code acting on MadeChange has a comment indicating that even when
set to true it should preserve the CG, but currently it does not.)

The attached ll-file can be used to provoke the bug using:
 opt -inline -functionattrs -reassociate reassoc-reduced.ll

The attached file originates from our randomised csmith test suite, but was
reduced to a minimum before inclusion here. I was unable to reduce the command
line to a single pass one.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20161025/cd4d0e0e/attachment.html>


More information about the llvm-bugs mailing list