<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 - [ppc] Assertion `hasValue() && "Cannot get the value bit index of a constant bit"' failed"
   href="https://bugs.llvm.org/show_bug.cgi?id=41088">41088</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[ppc] Assertion `hasValue() && "Cannot get the value bit index of a constant bit"' failed
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>8.0
          </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>Backend: PowerPC
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>jistone@redhat.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>inouehrs@jp.ibm.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=21602" name="attach_21602" title="bytecode reduced from rust #58996">attachment 21602</a> <a href="attachment.cgi?id=21602&action=edit" title="bytecode reduced from rust #58996">[details]</a></span>
bytecode reduced from rust #58996

Rust is seeing a bootstrap failure compiling itself for powerpc64 with LLVM
assertions enabled.

<a href="https://github.com/rust-lang/rust/issues/58996">https://github.com/rust-lang/rust/issues/58996</a>

rustc:
/checkout/src/llvm-project/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1114:
unsigned int {anonymous}::BitPermutationSelector::ValueBit::getValueBitIndex()
const: Assertion `hasValue() && "Cannot get the value bit index of a constant
bit"' failed.

I collected the bytecode from this, and I found that the assertion can be
reproduced with vanilla LLVM 8 and trunk, just by running llc. The attached
file is the bugpoint reduction. It compiles fine with LLVM 7, so I bisected the
crash and found r344347/D48025 (llvm-project commit 9552dd187aad).

<a href="https://reviews.llvm.org/D48025">https://reviews.llvm.org/D48025</a>

On that commit, the backtrace looks like this:

+ ./bin/llc /home/jistone/llvm-project/bugpoint-reduced-function.bc
llc:
/home/jistone/llvm-project/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1115:
unsigned int {anonymous}::BitPermutationSelector::ValueBit::getValueBitIndex()
const: Assertion `hasValue() && "Cannot get the value bit index of a constant
bit"' failed.
Stack dump:
0.      Program arguments: ./bin/llc
/home/jistone/llvm-project/bugpoint-reduced-function.bc
1.      Running pass 'Function Pass Manager' on module
'/home/jistone/llvm-project/bugpoint-reduced-function.bc'.
2.      Running pass 'PowerPC DAG->DAG Pattern Instruction Selection' on
function
'@"_ZN132_$LT$rustc..ty..layout..LayoutCx$LT$$u27$tcx$C$$u20$rustc..ty..context..TyCtxt$LT$$u27$a$C$$u20$$u27$tcx$C$$u20$$u27$tcx$GT$$GT$$GT$19layout_raw_uncached17h9e786af8095bbf87E"'
#0 0x000000000159791a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/home/jistone/llvm-project/llvm/lib/Support/Unix/Signals.inc:494:3
#1 0x0000000001595ea4 llvm::sys::RunSignalHandlers()
/home/jistone/llvm-project/llvm/lib/Support/Signals.cpp:67:5
#2 0x0000000001596005 SignalHandler(int)
/home/jistone/llvm-project/llvm/lib/Support/Unix/Signals.inc:353:1
#3 0x00007efc0e9b4030 __restore_rt (/lib64/libpthread.so.0+0x13030)
#4 0x00007efc0e48153f __GI_raise (/lib64/libc.so.6+0x3853f)
#5 0x00007efc0e46b895 __GI_abort (/lib64/libc.so.6+0x22895)
#6 0x00007efc0e46b769 _nl_load_domain.cold.0 (/lib64/libc.so.6+0x22769)
#7 0x00007efc0e4799f6 (/lib64/libc.so.6+0x309f6)
#8 0x00000000008dbe5e llvm::SDNode::getValueType(unsigned int) const
/home/jistone/llvm-project/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1115:7
#9 0x00000000008dbe5e llvm::SDValue::getValueType() const
/home/jistone/llvm-project/llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1110:34
#10 0x00000000008dbe5e (anonymous
namespace)::BitPermutationSelector::getValueBits(llvm::SDValue, unsigned int)
/home/jistone/llvm-project/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1318:26
#11 0x00000000008db6f7 (anonymous
namespace)::BitPermutationSelector::getValueBits(llvm::SDValue, unsigned int)
/usr/include/c++/8/tuple:1605:5
#12 0x00000000008dbb12 (anonymous
namespace)::BitPermutationSelector::getValueBits(llvm::SDValue, unsigned int)
/home/jistone/llvm-project/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1218:9
#13 0x00000000008dddc9 Select
/home/jistone/llvm-project/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:2342:71
#14 0x00000000008dddc9 tryBitPermutation
/home/jistone/llvm-project/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:3599:33
#15 0x00000000008dddc9 (anonymous
namespace)::PPCDAGToDAGISel::Select(llvm::SDNode*)
/home/jistone/llvm-project/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:4203:24
#16 0x0000000001464273 llvm::SmallVectorTemplateCommon<llvm::SDNode*,
void>::begin()
/home/jistone/llvm-project/llvm/include/llvm/ADT/SmallVector.h:851:3
#17 0x0000000001464273 llvm::SmallVectorTemplateCommon<llvm::SDNode*,
void>::end()
/home/jistone/llvm-project/llvm/include/llvm/ADT/SmallVector.h:133:35
#18 0x0000000001464273 _ZN4llvm11SmallVectorIPNS_6SDNodeELj4EED4Ev
/home/jistone/llvm-project/llvm/include/llvm/ADT/SmallVector.h:853:5
#19 0x0000000001464273 llvm::SelectionDAGISel::DoInstructionSelection()
/home/jistone/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1066:32
#20 0x000000000146ab2c _ZN4llvm10TimeRegionD4Ev
/home/jistone/llvm-project/llvm/include/llvm/Support/Timer.h:161:8
#21 0x000000000146ab2c _ZN4llvm16NamedRegionTimerD4Ev
/home/jistone/llvm-project/llvm/include/llvm/Support/Timer.h:161:8
#22 0x000000000146ab2c llvm::SelectionDAGISel::CodeGenAndEmitDAG()
/home/jistone/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:905:61
#23 0x000000000146fed7
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&)
/home/jistone/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1752:7
#24 0x0000000001471c9a
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&)
(.part.971)
/home/jistone/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:470:3
#25 0x00000000008e49d9 (anonymous
namespace)::PPCDAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&)
/home/jistone/llvm-project/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:155:7
#26 0x0000000000c9135e
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
/home/jistone/llvm-project/llvm/lib/CodeGen/MachineFunctionPass.cpp:74:33
#27 0x0000000000c9135e
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
/home/jistone/llvm-project/llvm/lib/CodeGen/MachineFunctionPass.cpp:39:6
#28 0x0000000000ff4c68 llvm::FPPassManager::runOnFunction(llvm::Function&)
/home/jistone/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1644:40
#29 0x0000000000ff4d49
llvm::ilist_node_impl<llvm::ilist_detail::node_options<llvm::Function, true,
false, void> >::getNext()
/home/jistone/llvm-project/llvm/include/llvm/ADT/ilist_node.h:67:66
#30 0x0000000000ff4d49
llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Function, true,
false, void>, false, false>::operator++()
/home/jistone/llvm-project/llvm/include/llvm/ADT/ilist_iterator.h:159:25
#31 0x0000000000ff4d49 llvm::FPPassManager::runOnModule(llvm::Module&)
/home/jistone/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1678:22
#32 0x0000000000ff40f8 runOnModule
/home/jistone/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1745:7
#33 0x0000000000ff40f8 llvm::legacy::PassManagerImpl::run(llvm::Module&)
/home/jistone/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1857:55
#34 0x00000000005c249c compileModule
/home/jistone/llvm-project/llvm/tools/llc/llc.cpp:599:5
#35 0x00000000005c249c main
/home/jistone/llvm-project/llvm/tools/llc/llc.cpp:351:35
#36 0x00007efc0e46d413 __libc_start_main (/lib64/libc.so.6+0x24413)
#37 0x0000000000601eae _start (./bin/llc+0x601eae)</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>