<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 - simple-loop-unswitch asserts after nontrivial unswitch: Assertion `use_empty() && "Uses remain when a value is destroyed!"' failed."
   href="https://bugs.llvm.org/show_bug.cgi?id=38778">38778</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>simple-loop-unswitch asserts after nontrivial unswitch: Assertion `use_empty() && "Uses remain when a value is destroyed!"' failed.
          </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>Linux
          </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>Loop Optimizer
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>fedor.v.sergeev@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Yet another assert on simple loop unswitch:
] cat bad-unswitch-reduced.ll
define void @Test(i32) {
  br label %loop
loop:
  switch i32 %0, label %continue [
    i32 -2147483648, label %check
    i32 98, label %guarded1
    i32 99, label %guarded2
  ]
guarded1:
  br i1 undef, label %continue, label %leave
guarded2:
  br label %continue
check:
  %val = add i32 0, 1
  br i1 undef, label %continue, label %leave
continue:
  br label %loop
leave:
  %local = phi i32 [ 0, %guarded1 ], [ %val, %check ]
  ret void
}
] DEBUG/bin/opt -passes=unswitch -enable-nontrivial-unswitch
bad-unswitch-reduced.ll 2>&1 -disable-output | head
While deleting: i32 %val
Use still stuck around after Def is destroyed:  %.us-phi5 = phi i32 [ %val,
%leave.split.split ], [ %local.us4, %leave.split.split.us ]
opt: /home/fsergeev/work/orca/lib/IR/Value.cpp:92: llvm::Value::~Value():
Assertion `use_empty() && "Uses remain when a value is destroyed!"' failed.
Stack dump:
0.      Program arguments:
/home/fsergeev/work/sandbox/fromorca/installDA/bin/opt -passes=unswitch
-enable-nontrivial-unswitch bad-unswitch-reduced.ll -disable-output 
#0 0x00007f520b8f4a68 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/home/fsergeev/work/orca/lib/Support/Unix/Signals.inc:490:0
#1 0x00007f520b8f4af9 PrintStackTraceSignalHandler(void*)
/home/fsergeev/work/orca/lib/Support/Unix/Signals.inc:554:0
#2 0x00007f520b8f2b09 llvm::sys::RunSignalHandlers()
/home/fsergeev/work/orca/lib/Support/Signals.cpp:67:0
#3 0x00007f520b8f4509 SignalHandler(int)
/home/fsergeev/work/orca/lib/Support/Unix/Signals.inc:353:0
#4 0x00007f52092fa390 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
]

It happens during deleteDeadBlocksFromLoop cleanup.
Recent change for 38737 does not affect this failure.</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>