<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 - llc aborts, clang error 70 on specific PPC64 CTR Loop bitcode at -O1 and beyond"
   href="https://bugs.llvm.org/show_bug.cgi?id=37050">37050</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>llc aborts, clang error 70 on specific PPC64 CTR Loop bitcode at -O1 and beyond
          </td>
        </tr>

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

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

        <tr>
          <th>Hardware</th>
          <td>Other
          </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>new bugs
          </td>
        </tr>

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

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

        <tr>
          <th>CC</th>
          <td>dje.gcc@gmail.com, echristo@gmail.com, hfinkel@anl.gov, kit.barton@gmail.com, llvm-bugs@lists.llvm.org, nemanja.i.ibm@gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=20173" name="attach_20173" title="Abort/error-inducing bitcode">attachment 20173</a> <a href="attachment.cgi?id=20173&action=edit" title="Abort/error-inducing bitcode">[details]</a></span>
Abort/error-inducing bitcode

While debugging an "Invalid PPC CTR loop!" problem with LLVM JIT codegen for
Numba (<a href="https://github.com/numba/numba/issues/2451#issuecomment-379629091">https://github.com/numba/numba/issues/2451#issuecomment-379629091</a>), I
managed to isolate an ugly, 186KB LLVM IR module that caused both llc and
clang-7.0.0svn trunk to abort() with that "Invalid PPC CTR loop!" message.

Bugpoint then stripped it down to 1.6KB of bitcode that causes Clang to error
out (exit code 70) instead, but llc still aborts in the same way.

Bitcode is attached. Console printouts below. All this is also viewable at the
Numba Github link above.


The Clang error printout:

$ clang -O3 -v -c crashir-reduced.bc -o crashir-reduced.bc.o
clang version 7.0.0 (<a href="https://git.llvm.org/git/clang.git/">https://git.llvm.org/git/clang.git/</a>
f38834898ad991aec557e2a609c6b7c3b288bf10) (<a href="https://git.llvm.org/git/llvm.git/">https://git.llvm.org/git/llvm.git/</a>
32d2ff0d0ffc54839092ace1e9d101a1fc1461b7)
Target: powerpc64le-unknown-linux-gnu
Thread model: posix
InstalledDir: /.local/bin
Found candidate GCC installation: /usr/lib/gcc/ppc64le-redhat-linux/4.8.2
Found candidate GCC installation: /usr/lib/gcc/ppc64le-redhat-linux/4.8.5
Selected GCC installation: /usr/lib/gcc/ppc64le-redhat-linux/4.8.5
Candidate multilib: .;@m64
Selected multilib: .;@m64
 "/.local/bin/clang-7" -cc1 -triple powerpc64le-unknown-linux-gnu -emit-obj
-disable-free -main-file-name crashir-reduced.bc -mrelocation-model pic
-pic-level 2 -mthread-model posix -fmath-errno -masm-verbose
-mconstructor-aliases -fuse-init-array -target-cpu ppc64le -mfloat-abi hard
-target-abi elfv2 -dwarf-column-info -debugger-tuning=gdb
-momit-leaf-frame-pointer -v -coverage-notes-file
/NUMBA_SOURCE_PATH/bugpointwdir/crashir-reduced.bc.gcno -resource-dir
/.local/lib/clang/7.0.0 -O3 -fdebug-compilation-dir
/NUMBA_SOURCE_PATH/bugpointwdir -ferror-limit 19 -fmessage-length 184
-fno-signed-char -fobjc-runtime=gcc -fdiagnostics-show-option
-fcolor-diagnostics -vectorize-loops -vectorize-slp -o crashir-reduced.bc.o -x
ir crashir-reduced.bc
clang -cc1 version 7.0.0 based upon LLVM 7.0.0svn default target
powerpc64le-unknown-linux-gnu
fatal error: error in backend: Cannot select: intrinsic
%llvm.ppc.is.decremented.ctr.nonzero
clang-7: error: clang frontend command failed with exit code 70 (use -v to see
invocation)
clang version 7.0.0 (<a href="https://git.llvm.org/git/clang.git/">https://git.llvm.org/git/clang.git/</a>
f38834898ad991aec557e2a609c6b7c3b288bf10) (<a href="https://git.llvm.org/git/llvm.git/">https://git.llvm.org/git/llvm.git/</a>
32d2ff0d0ffc54839092ace1e9d101a1fc1461b7)
Target: powerpc64le-unknown-linux-gnu
Thread model: posix
InstalledDir: /.local/bin
clang-7: note: diagnostic msg: PLEASE submit a bug report to
<a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash backtrace, preprocessed source,
and associated run script.
clang-7: note: diagnostic msg: Error generating preprocessed source(s) - no
preprocessable inputs.



The llc printout:

$ llc -O3 crashir-reduced.bc -o crashir-reduced.bc.o   
Invalid PPC CTR loop!
UNREACHABLE executed at
/LLVM_SOURCE_PATH/lib/Target/PowerPC/PPCCTRLoops.cpp:777!
LLVMSymbolizer: error reading file: No such file or directory
#0 0x000000001271c7e0 (llc+0x1271c7e0)
#1 0x000000001271c8e4 (llc+0x1271c8e4)
#2 0x000000001271a568 (llc+0x1271a568)
#3 0x000000001271bd88 (llc+0x1271bd88)
#4 0x00003fff9ab50478  0x478 __GI_abort
#5 0x00003fff9ab50478 
#6 0x00003fff9ab50478 (+0x478)
#7 0x00003fff9a610d70 (/lib64/libc.so.6+0x40d70)
#8 0x00000000126666e8 (llc+0x126666e8)
#9 0x0000000010c4bcd4 (llc+0x10c4bcd4)
#10 0x0000000011555c24 (llc+0x11555c24)
#11 0x0000000011c87390 (llc+0x11c87390)
#12 0x0000000011c875f4 (llc+0x11c875f4)
#13 0x0000000011c87b80 (llc+0x11c87b80)
#14 0x0000000011c884ec (llc+0x11c884ec)
#15 0x0000000011c888c8 (llc+0x11c888c8)
#16 0x0000000010b6ceac generic_start_main.isra.0 (llc+0x10b6ceac)
#17 0x0000000010b6b3b8 __libc_start_main (llc+0x10b6b3b8)
llc(_ZN4llvm3sys15PrintStackTraceERNS_11raw_ostreamE+0x58)[0x1271c7e0]
llc[0x1271c8e4]
llc(_ZN4llvm3sys17RunSignalHandlersEv+0xb4)[0x1271a568]
llc[0x1271bd88]
[0x3fff9ab50478]
/lib64/libc.so.6(abort+0x280)[0x3fff9a610d70]
llc(_ZN4llvm25llvm_unreachable_internalEPKcS1_j+0x104)[0x126666e8]
llc[0x10c4bcd4]
llc(_ZN4llvm19MachineFunctionPass13runOnFunctionERNS_8FunctionE+0x22c)[0x11555c24]
llc(_ZN4llvm13FPPassManager13runOnFunctionERNS_8FunctionE+0x170)[0x11c87390]
llc(_ZN4llvm13FPPassManager11runOnModuleERNS_6ModuleE+0x74)[0x11c875f4]
llc[0x11c87b80]
llc(_ZN4llvm6legacy15PassManagerImpl3runERNS_6ModuleE+0x164)[0x11c884ec]
llc(_ZN4llvm6legacy11PassManager3runERNS_6ModuleE+0x38)[0x11c888c8]
llc[0x10b6ceac]
llc(main+0x580)[0x10b6b3b8]
/lib64/libc.so.6(+0x24700)[0x3fff9a5f4700]
/lib64/libc.so.6(__libc_start_main+0xc4)[0x3fff9a5f48f4]
Stack dump:
0.      Program arguments: llc -O3 crashir-reduced.bc -o crashir-reduced.bc.o 
1.      Running pass 'Function Pass Manager' on module 'crashir-reduced.bc'.
2.      Running pass 'PowerPC CTR Loops Verify' on function
'@"_ZN5numba5tests7timsort12merge_lo$244E149MergeState$28int64$2c$20array$28int32$2c$201d$2c$20C$29$2c$20array$28int32$2c$201d$2c$20C$29$2c$20list$28MergeRun$28int64$20x$202$29$29$2c$20int64$295ArrayIiLi1E1C7mutable7alignedE5ArrayIiLi1E1C7mutable7alignedExxxx"'
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>