<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 - [GlobalISel] Crash on llc due to usub intrinsic"
   href="https://bugs.llvm.org/show_bug.cgi?id=49087">49087</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[GlobalISel] Crash on llc due to usub intrinsic
          </td>
        </tr>

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

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

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

        <tr>
          <th>OS</th>
          <td>Windows NT
          </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>max.kazantsev@azul.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Run: llc test.ll -o - -global-isel

test.ll:
define i32 @test_01(i32* %p, i64 %len, i32 %x) {
entry:
  %scevgep = getelementptr i32, i32* %p, i64 -1
  br label %loop

loop:                                             ; preds = %backedge, %entry
  %iv = phi i64 [ %iv.next, %backedge ], [ %len, %entry ]
  %iv.next = add i64 %iv, -1
  %cond_1 = icmp eq i64 %iv, 0
  br i1 %cond_1, label %exit, label %backedge

backedge:                                         ; preds = %loop
  %scevgep1 = getelementptr i32, i32* %scevgep, i64 %iv
  %loaded = load atomic i32, i32* %scevgep1 unordered, align 4
  %cond_2 = icmp eq i32 %loaded, %x
  br i1 %cond_2, label %failure, label %loop

exit:                                             ; preds = %loop
  ret i32 -1

failure:
  unreachable
}


Crash:
        .text
        .file   "bug.ll"
LLVM ERROR: unable to legalize instruction: %4:_(s64), %5:_(s1) = G_USUBO %3:_,
%6:_ (in function: test_01)
PLEASE submit a bug report to <a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash
backtrace.
Stack dump:
0.      Program arguments: /localhome/mkazantsev/work/llvm/build/RA/bin/llc
test/CodeGen/X86/bug.ll -o - -global-isel
1.      Running pass 'Function Pass Manager' on module
'test/CodeGen/X86/bug.ll'.
2.      Running pass 'Legalizer' on function '@test_01'
 #0 0x00000000028328ac llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
/localhome/mkazantsev/work/llvm/llvm/llvm/lib/Support/Unix/Signals.inc:569:0
 #1 0x00000000028307b4 llvm::sys::RunSignalHandlers()
/localhome/mkazantsev/work/llvm/llvm/llvm/lib/Support/Signals.cpp:71:0
 #2 0x00000000028310f3 SignalHandler(int)
/localhome/mkazantsev/work/llvm/llvm/llvm/lib/Support/Unix/Signals.inc:397:0
 #3 0x00007f565d6c1630 __restore_rt (/lib64/libpthread.so.0+0xf630)
 #4 0x00007f565c21d387 raise (/lib64/libc.so.6+0x36387)
 #5 0x00007f565c21ea78 abort (/lib64/libc.so.6+0x37a78)
 #6 0x00000000027aec73
llvm::raw_svector_ostream::raw_svector_ostream(llvm::SmallVectorImpl<char>&)
/localhome/mkazantsev/work/llvm/llvm/llvm/include/llvm/Support/raw_ostream.h:652:0
 #7 0x00000000027aec73 llvm::report_fatal_error(llvm::Twine const&, bool)
/localhome/mkazantsev/work/llvm/llvm/llvm/lib/Support/ErrorHandling.cpp:114:0
 #8 0x00000000027aedbe
(/localhome/mkazantsev/work/llvm/build/RA/bin/llc+0x27aedbe)
 #9 0x0000000002e9078f reportGISelDiagnostic(llvm::DiagnosticSeverity,
llvm::MachineFunction&, llvm::TargetPassConfig const&,
llvm::MachineOptimizationRemarkEmitter&,
llvm::MachineOptimizationRemarkMissed&)
/localhome/mkazantsev/work/llvm/llvm/llvm/lib/CodeGen/GlobalISel/Utils.cpp:234:0
#10 0x0000000002e918e2
llvm::DiagnosticInfoOptimizationBase::~DiagnosticInfoOptimizationBase()
/localhome/mkazantsev/work/llvm/llvm/llvm/include/llvm/IR/DiagnosticInfo.h:407:0
#11 0x0000000002e918e2
llvm::DiagnosticInfoMIROptimization::~DiagnosticInfoMIROptimization()
/localhome/mkazantsev/work/llvm/llvm/llvm/include/llvm/CodeGen/MachineOptimizationRemarkEmitter.h:28:0
#12 0x0000000002e918e2
llvm::MachineOptimizationRemarkMissed::~MachineOptimizationRemarkMissed()
/localhome/mkazantsev/work/llvm/llvm/llvm/include/llvm/CodeGen/MachineOptimizationRemarkEmitter.h:82:0
#13 0x0000000002e918e2 llvm::reportGISelFailure(llvm::MachineFunction&,
llvm::TargetPassConfig const&, llvm::MachineOptimizationRemarkEmitter&, char
const*, llvm::StringRef, llvm::MachineInstr const&)
/localhome/mkazantsev/work/llvm/llvm/llvm/lib/CodeGen/GlobalISel/Utils.cpp:257:0
#14 0x0000000002e4168a
llvm::Legalizer::runOnMachineFunction(llvm::MachineFunction&) (.part.268)
/localhome/mkazantsev/work/llvm/llvm/llvm/lib/CodeGen/GlobalISel/Legalizer.cpp:351:0
#15 0x0000000001d3ec67
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
/localhome/mkazantsev/work/llvm/llvm/llvm/lib/CodeGen/MachineFunctionPass.cpp:72:0
#16 0x000000000213d75b llvm::FPPassManager::runOnFunction(llvm::Function&)
/localhome/mkazantsev/work/llvm/llvm/llvm/lib/IR/LegacyPassManager.cpp:1445:0
#17 0x000000000213e1d9
llvm::ilist_node_impl<llvm::ilist_detail::node_options<llvm::Function, true,
false, void> >::getNext()
/localhome/mkazantsev/work/llvm/llvm/llvm/include/llvm/ADT/ilist_node.h:66:0
#18 0x000000000213e1d9
llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Function, true,
false, void>, false, false>::operator++()
/localhome/mkazantsev/work/llvm/llvm/llvm/include/llvm/ADT/ilist_iterator.h:157:0
#19 0x000000000213e1d9 llvm::FPPassManager::runOnModule(llvm::Module&)
/localhome/mkazantsev/work/llvm/llvm/llvm/lib/IR/LegacyPassManager.cpp:1480:0
#20 0x000000000213d08e runOnModule
/localhome/mkazantsev/work/llvm/llvm/llvm/lib/IR/LegacyPassManager.cpp:1557:0
#21 0x000000000213d08e llvm::legacy::PassManagerImpl::run(llvm::Module&)
/localhome/mkazantsev/work/llvm/llvm/llvm/lib/IR/LegacyPassManager.cpp:541:0
#22 0x00000000007f60fa compileModule(char**, llvm::LLVMContext&)
/localhome/mkazantsev/work/llvm/llvm/llvm/tools/llc/llc.cpp:687:0
#23 0x000000000072dd7e main
/localhome/mkazantsev/work/llvm/llvm/llvm/tools/llc/llc.cpp:385:0
#24 0x00007f565c209555 __libc_start_main (/lib64/libc.so.6+0x22555)
#25 0x00000000007ee049 _start
(/localhome/mkazantsev/work/llvm/build/RA/bin/llc+0x7ee049)
Aborted (core dumped)</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>