<html>
    <head>
      <base href="https://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 --- - Crash/assert when using regalloc= with -O0"
   href="https://llvm.org/bugs/show_bug.cgi?id=31597">31597</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Crash/assert when using regalloc= with -O0
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>tools
          </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>llc
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>jonathanchesterfield@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Repro:

echo "define i32 @main() { ret i32 0 }" | llc -O0 --regalloc=basic
echo "define i32 @main() { ret i32 0 }" | llc -O0 --regalloc=greedy
echo "define i32 @main() { ret i32 0 }" | llc -O0 --regalloc=pbqp

Any of these cause a segfault on release builds of 3.9 and trunk. On a debug
build of trunk an assertion fires, stack trace below.

Older versions of llvm (checked 3.5 and 3.8) print "LLVM ERROR: regalloc=...
not currently supported with -O0"

This was discovered while debugging a probably unrelated issue in the fast
allocator when I tried to compare it with the basic allocator. Ideally the
allocators would all work correctly at O0, but failing that perhaps we should
reinstate the error message at O0.

Cheers

    .text
    .file    "<stdin>"
MachineFunctionProperties required by X86 FP Stackifier pass are not met by
function main.
Required properties: NoVRegs
Current properties: NoPHIs, TracksLiveness
MachineFunctionProperties check failed
UNREACHABLE executed at
/home/jon/trunk/llvm/lib/CodeGen/MachineFunctionPass.cpp:58!
#0 0x0000000002b18a53 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/home/jon/trunk/llvm/lib/Support/Unix/Signals.inc:402:0
#1 0x0000000002b18e15 PrintStackTraceSignalHandler(void*)
/home/jon/trunk/llvm/lib/Support/Unix/Signals.inc:466:0
#2 0x0000000002b17072 llvm::sys::RunSignalHandlers()
/home/jon/trunk/llvm/lib/Support/Signals.cpp:44:0
#3 0x0000000002b183e5 SignalHandler(int)
/home/jon/trunk/llvm/lib/Support/Unix/Signals.inc:256:0
#4 0x00007f89c8a9c7e0 __restore_rt (/lib64/libpthread.so.0+0xf7e0)
#5 0x00007f89c77485e5 __GI_raise (/lib64/libc.so.6+0x325e5)
#6 0x00007f89c7749dc5 __GI_abort (/lib64/libc.so.6+0x33dc5)
#7 0x0000000002aa66b6 bindingsErrorHandler(void*, std::string const&, bool)
/home/jon/trunk/llvm/lib/Support/ErrorHandling.cpp:127:0
#8 0x0000000002277517 llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
/home/jon/trunk/llvm/lib/CodeGen/MachineFunctionPass.cpp:62:0
#9 0x00000000025fa128 llvm::FPPassManager::runOnFunction(llvm::Function&)
/home/jon/trunk/llvm/lib/IR/LegacyPassManager.cpp:1513:0
#10 0x00000000025fa2bb llvm::FPPassManager::runOnModule(llvm::Module&)
/home/jon/trunk/llvm/lib/IR/LegacyPassManager.cpp:1534:0
#11 0x00000000025fa647 (anonymous
namespace)::MPPassManager::runOnModule(llvm::Module&)
/home/jon/trunk/llvm/lib/IR/LegacyPassManager.cpp:1590:0
#12 0x00000000025fad38 llvm::legacy::PassManagerImpl::run(llvm::Module&)
/home/jon/trunk/llvm/lib/IR/LegacyPassManager.cpp:1693:0
#13 0x00000000025faf79 llvm::legacy::PassManager::run(llvm::Module&)
/home/jon/trunk/llvm/lib/IR/LegacyPassManager.cpp:1725:0
#14 0x0000000000fbcbf5 compileModule(char**, llvm::LLVMContext&)
/home/jon/trunk/llvm/tools/llc/llc.cpp:530:0
#15 0x0000000000fbb311 main /home/jon/trunk/llvm/tools/llc/llc.cpp:285:0
#16 0x00007f89c7734d1d __libc_start_main (/lib64/libc.so.6+0x1ed1d)
#17 0x0000000000fb9551 _start (./llc+0xfb9551)
Stack dump:
0.    Program arguments: ./llc -O0 --regalloc=basic
1.    Running pass 'Function Pass Manager' on module '<stdin>'.
2.    Running pass 'X86 FP Stackifier' on function '@main'
Aborted</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>