<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 - Greedy Register Allocator fires an assert"
   href="https://bugs.llvm.org/show_bug.cgi?id=40061">40061</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Greedy Register Allocator fires an assert
          </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>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>Register Allocator
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>serguei.katkov@azul.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, quentin.colombet@gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=21240" name="attach_21240" title="Reproducer">attachment 21240</a> <a href="attachment.cgi?id=21240&action=edit" title="Reproducer">[details]</a></span>
Reproducer

The following assert is fired in Greedy Register allocator after the commit
<a href="https://reviews.llvm.org/rL339035">https://reviews.llvm.org/rL339035</a>:
$ ~/work/llvm/build/buildDA/bin/llc -late-remat-update-threshold=0
-code-model=large 1.ll -o /dev/null
llc: /home/skatkov/work/llvm/src/include/llvm/ADT/IntervalMap.h:631: unsigned
int llvm::IntervalMapImpl::LeafNode<KeyT, ValT, N, Traits>::insertFrom(unsigned
int&, unsigned int, KeyT, KeyT, ValT) [with KeyT = llvm::SlotIndex; ValT =
unsigned int; unsigned int N = 9u; Traits =
llvm::IntervalMapInfo<llvm::SlotIndex>]: Assertion `!Traits::stopLess(b, a) &&
"Invalid interval"' failed.
Stack dump:
0.      Program arguments: /home/skatkov/work/llvm/build/buildDA/bin/llc
-late-remat-update-threshold=0 -code-model=large 1.ll -o /dev/null
1.      Running pass 'Function Pass Manager' on module '1.ll'.
2.      Running pass 'Greedy Register Allocator' on function '@test'
#0 0x00007fe0eebbdbc5 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/home/skatkov/work/llvm/src/lib/Support/Unix/Signals.inc:495:0
#1 0x00007fe0eebbdc56 PrintStackTraceSignalHandler(void*)
/home/skatkov/work/llvm/src/lib/Support/Unix/Signals.inc:559:0
#2 0x00007fe0eebbbc91 llvm::sys::RunSignalHandlers()
/home/skatkov/work/llvm/src/lib/Support/Signals.cpp:67:0
#3 0x00007fe0eebbd669 SignalHandler(int)
/home/skatkov/work/llvm/src/lib/Support/Unix/Signals.inc:358:0
#4 0x00007fe0ebacd6d0 __restore_rt (/lib64/libpthread.so.0+0xf6d0)
#5 0x00007fe0eaef7277 __GI_raise
/usr/src/debug/glibc-2.17-c758a686/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#6 0x00007fe0eaef8968 __GI_abort
/usr/src/debug/glibc-2.17-c758a686/stdlib/abort.c:92:0
#7 0x00007fe0eaef0096 __assert_fail_base
/usr/src/debug/glibc-2.17-c758a686/assert/assert.c:92:0
#8 0x00007fe0eaef0142 (/lib64/libc.so.6+0x2f142)
#9 0x00007fe0ef34e0c4 llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned
int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::insertFrom(unsigned int&,
unsigned int, llvm::SlotIndex, llvm::SlotIndex, unsigned int)
/home/skatkov/work/llvm/src/include/llvm/ADT/IntervalMap.h:634:0
#10 0x00007fe0ef34c89f llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u,
llvm::IntervalMapInfo<llvm::SlotIndex> >::insert(llvm::SlotIndex,
llvm::SlotIndex, unsigned int)
/home/skatkov/work/llvm/src/include/llvm/ADT/IntervalMap.h:1089:0
#11 0x00007fe0ef34423c llvm::SplitEditor::useIntv(llvm::SlotIndex,
llvm::SlotIndex) /home/skatkov/work/llvm/src/lib/CodeGen/SplitKit.cpp:755:0
#12 0x00007fe0ef349321
llvm::SplitEditor::splitSingleBlock(llvm::SplitAnalysis::BlockInfo const&)
/home/skatkov/work/llvm/src/lib/CodeGen/SplitKit.cpp:1580:0
#13 0x00007fe0ef289da0 (anonymous
namespace)::RAGreedy::splitAroundRegion(llvm::LiveRangeEdit&,
llvm::ArrayRef<unsigned int>)
/home/skatkov/work/llvm/src/lib/CodeGen/RegAllocGreedy.cpp:1708:0
#14 0x00007fe0ef28ba26 (anonymous
namespace)::RAGreedy::doRegionSplit(llvm::LiveInterval&, unsigned int, bool,
llvm::SmallVectorImpl<unsigned int>&)
/home/skatkov/work/llvm/src/lib/CodeGen/RegAllocGreedy.cpp:1995:0
#15 0x00007fe0ef28a959 (anonymous
namespace)::RAGreedy::tryRegionSplit(llvm::LiveInterval&,
llvm::AllocationOrder&, llvm::SmallVectorImpl<unsigned int>&)
/home/skatkov/work/llvm/src/lib/CodeGen/RegAllocGreedy.cpp:1856:0
#16 0x00007fe0ef28e6a2 (anonymous
namespace)::RAGreedy::trySplit(llvm::LiveInterval&, llvm::AllocationOrder&,
llvm::SmallVectorImpl<unsigned int>&)
/home/skatkov/work/llvm/src/lib/CodeGen/RegAllocGreedy.cpp:2483:0
#17 0x00007fe0ef290a78 (anonymous
namespace)::RAGreedy::selectOrSplitImpl(llvm::LiveInterval&,
llvm::SmallVectorImpl<unsigned int>&, llvm::SmallSet<unsigned int, 16u,
std::less<unsigned int> >&, unsigned int)
/home/skatkov/work/llvm/src/lib/CodeGen/RegAllocGreedy.cpp:3082:0
#18 0x00007fe0ef28f814 (anonymous
namespace)::RAGreedy::selectOrSplit(llvm::LiveInterval&,
llvm::SmallVectorImpl<unsigned int>&)
/home/skatkov/work/llvm/src/lib/CodeGen/RegAllocGreedy.cpp:2762:0
#19 0x00007fe0ef279e0c llvm::RegAllocBase::allocatePhysRegs()
/home/skatkov/work/llvm/src/lib/CodeGen/RegAllocBase.cpp:113:0
#20 0x00007fe0ef291eb3 (anonymous
namespace)::RAGreedy::runOnMachineFunction(llvm::MachineFunction&)
/home/skatkov/work/llvm/src/lib/CodeGen/RegAllocGreedy.cpp:3243:0
#21 0x00007fe0ef128390
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
/home/skatkov/work/llvm/src/lib/CodeGen/MachineFunctionPass.cpp:74:0
#22 0x00007fe0eedd9b5c llvm::FPPassManager::runOnFunction(llvm::Function&)
/home/skatkov/work/llvm/src/lib/IR/LegacyPassManager.cpp:1644:0
#23 0x00007fe0eedd9d99 llvm::FPPassManager::runOnModule(llvm::Module&)
/home/skatkov/work/llvm/src/lib/IR/LegacyPassManager.cpp:1679:0
#24 0x00007fe0eedda181 (anonymous
namespace)::MPPassManager::runOnModule(llvm::Module&)
/home/skatkov/work/llvm/src/lib/IR/LegacyPassManager.cpp:1744:0
#25 0x00007fe0eedda951 llvm::legacy::PassManagerImpl::run(llvm::Module&)
/home/skatkov/work/llvm/src/lib/IR/LegacyPassManager.cpp:1857:0
#26 0x00007fe0eeddabd1 llvm::legacy::PassManager::run(llvm::Module&)
/home/skatkov/work/llvm/src/lib/IR/LegacyPassManager.cpp:1889:0
#27 0x0000000000432674 compileModule(char**, llvm::LLVMContext&)
/home/skatkov/work/llvm/src/tools/llc/llc.cpp:600:0
#28 0x00000000004309af main /home/skatkov/work/llvm/src/tools/llc/llc.cpp:351:0
#29 0x00007fe0eaee3445 __libc_start_main
/usr/src/debug/glibc-2.17-c758a686/csu/../csu/libc-start.c:308:0
#30 0x000000000042e889 _start
(/home/skatkov/work/llvm/build/buildDA/bin/llc+0x42e889)
Aborted (core dumped)

The crash is not reproducible if I run it as:
$ ~/work/llvm/build/buildDA/bin/llc -late-remat-update-threshold=100000
-code-model=large 1.ll -o /dev/null

The reproducer is reduced by bugpoint.</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>