<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </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 --- - r226781 exposes: N->use_empty() && "Cannot delete a node that is not dead!""
   href="http://llvm.org/bugs/show_bug.cgi?id=22524">22524</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>r226781 exposes: N->use_empty() && "Cannot delete a node that is not dead!"
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Backend: X86
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>dexonsmith@apple.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=13832" name="attach_13832" title="opt+llc.ll">attachment 13832</a> <a href="attachment.cgi?id=13832&action=edit" title="opt+llc.ll">[details]</a></span>
opt+llc.ll

Bisection of a testcase reveals that r226781 (canonicalization change to
-instcombine) exposes a bug in DAGCombiner where it's trying to delete a
non-dead node.

The attached testcases repro in r228581.

$ head -n 1 opt+llc.ll 
; RUN: opt -basicaa -inline -sroa -instcombine -gvn -dse < %s | llc -o
/dev/null
$ head -n 1 llc.ll 
; RUN: llc < %s -o /dev/null

Here's the assertion failure:

Assertion failed: (N->use_empty() && "Cannot delete a node that is not dead!"),
function DeleteNodeNotInCSEMaps, file
/Users/dexonsmith/data/llvm/staging/lib/CodeGen/SelectionDAG/SelectionDAG.cpp,
line 682.
0  llc                      0x000000010dd754ee
llvm::sys::PrintStackTrace(__sFILE*) + 46
1  llc                      0x000000010dd76bbb
PrintStackTraceSignalHandler(void*) + 27
2  llc                      0x000000010dd7700f SignalHandler(int) + 559
3  libsystem_platform.dylib 0x00007fff8fd80f1a _sigtramp + 26
4  llc                      0x000000010e6d6ce9 ErrorCategory + 80889
5  llc                      0x000000010dd76beb raise + 27
6  llc                      0x000000010dd76ca2 abort + 18
7  llc                      0x000000010dd76c81 __assert_rtn + 129
8  llc                      0x000000010db459ec
llvm::SelectionDAG::DeleteNodeNotInCSEMaps(llvm::SDNode*) + 252
9  llc                      0x000000010db458df
llvm::SelectionDAG::DeleteNode(llvm::SDNode*) + 63
10 llc                      0x000000010d9ad68f (anonymous
namespace)::DAGCombiner::deleteAndRecombine(llvm::SDNode*) + 239
11 llc                      0x000000010d9d7dc1 (anonymous
namespace)::DAGCombiner::visitBITCAST(llvm::SDNode*) + 769
12 llc                      0x000000010d9ab587 (anonymous
namespace)::DAGCombiner::visit(llvm::SDNode*) + 1143
13 llc                      0x000000010d9aaa58 (anonymous
namespace)::DAGCombiner::combine(llvm::SDNode*) + 56
14 llc                      0x000000010d9aa23e (anonymous
namespace)::DAGCombiner::Run(llvm::CombineLevel) + 1278
15 llc                      0x000000010d9a9cc8
llvm::SelectionDAG::Combine(llvm::CombineLevel, llvm::AliasAnalysis&,
llvm::CodeGenOpt::Level) + 104
16 llc                      0x000000010dc28081
llvm::SelectionDAGISel::CodeGenAndEmitDAG() + 7249
17 llc                      0x000000010dc2641f
llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator<llvm::Instruction
const>, llvm::ilist_iterator<llvm::Instruction const>, bool&) + 255
18 llc                      0x000000010dc260f9
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) + 5225
19 llc                      0x000000010dc2397e
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) + 1134
20 llc                      0x000000010ccea83b (anonymous
namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) + 59
21 llc                      0x000000010d30633e
llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 110
22 llc                      0x000000010d7573cd
llvm::FPPassManager::runOnFunction(llvm::Function&) + 413
23 llc                      0x000000010d7576d8
llvm::FPPassManager::runOnModule(llvm::Module&) + 104
24 llc                      0x000000010d7580d3 (anonymous
namespace)::MPPassManager::runOnModule(llvm::Module&) + 1395
25 llc                      0x000000010d75798e
llvm::legacy::PassManagerImpl::run(llvm::Module&) + 302
26 llc                      0x000000010d758851
llvm::legacy::PassManager::run(llvm::Module&) + 33
27 llc                      0x000000010c2600aa compileModule(char**,
llvm::LLVMContext&) + 7802
28 llc                      0x000000010c25e1c2 main + 226
29 libdyld.dylib            0x00007fff92ea35c9 start + 1</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>