<html>
    <head>
      <base href="http://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 --- - Can't always pass i1 as stackmap args"
   href="http://llvm.org/bugs/show_bug.cgi?id=21283">21283</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Can't always pass i1 as stackmap args
          </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>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Common Code Generator Code
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>kmod@dropbox.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=13205" name="attach_13205" title=""llc legalize.ll"">attachment 13205</a> <a href="attachment.cgi?id=13205&action=edit" title=""llc legalize.ll"">[details]</a></span>
"llc legalize.ll"

I don't really understand all the legalization and custom lowering, but it
looks like stackmaps have trouble getting passed an i1 (or other illegal
integer type) argument if we don't have a legalized representation already
available.  So it works to pass a function argument or a constant, but we can't
pass a phi, for example.

Here's what I end up seeing:

$ gdb --args llc legalize.ll
[snip]
Should not custom lower this!
UNREACHABLE executed at
/mnt/kmod/pyston_deps/llvm-test/lib/Target/X86/X86ISelLowering.cpp:18663!

Program received signal SIGABRT, Aborted.
0x00007ffff69c8bb9 in raise () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) bt
#0  0x00007ffff69c8bb9 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007ffff69cbfc8 in abort () from /lib/x86_64-linux-gnu/libc.so.6
#2  0x000000000147d45a in llvm::llvm_unreachable_internal (msg=0x156d093
"Should not custom lower this!", 
    file=0x1567d08
"/mnt/kmod/pyston_deps/llvm-test/lib/Target/X86/X86ISelLowering.cpp",
line=18663)
    at /mnt/kmod/pyston_deps/llvm-test/lib/Support/ErrorHandling.cpp:117
#3  0x0000000000a62fef in llvm::X86TargetLowering::LowerOperation
(this=0x202d9e0, Op=..., DAG=...)
    at /mnt/kmod/pyston_deps/llvm-test/lib/Target/X86/X86ISelLowering.cpp:18663
#4  0x0000000000c395ab in llvm::TargetLowering::LowerOperationWrapper
(this=0x202d9e0, N=0x208e098, Results=..., DAG=...)
    at
/mnt/kmod/pyston_deps/llvm-test/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:7377
#5  0x0000000000c96c9c in llvm::DAGTypeLegalizer::CustomLowerNode
(this=0x7fffffffba50, N=0x208e098, VT=..., LegalizeResult=false)
    at
/mnt/kmod/pyston_deps/llvm-test/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp:918
#6  0x0000000000cd2a80 in llvm::DAGTypeLegalizer::PromoteIntegerOperand
(this=0x7fffffffba50, N=0x208e098, OpNo=5)
    at
/mnt/kmod/pyston_deps/llvm-test/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp:792
#7  0x0000000000c93ad8 in llvm::DAGTypeLegalizer::run (this=0x7fffffffba50)
    at
/mnt/kmod/pyston_deps/llvm-test/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp:284
#8  0x0000000000c9856b in llvm::SelectionDAG::LegalizeTypes (this=0x2056400)
    at
/mnt/kmod/pyston_deps/llvm-test/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp:1113
#9  0x0000000000c5a780 in llvm::SelectionDAGISel::CodeGenAndEmitDAG
(this=0x2056090)
    at
/mnt/kmod/pyston_deps/llvm-test/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:685
#10 0x0000000000c59fc9 in llvm::SelectionDAGISel::SelectBasicBlock
(this=0x2056090, Begin=..., End=..., HadTailCall=@0x7fffffffcc9f: false)
    at
/mnt/kmod/pyston_deps/llvm-test/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:602
#11 0x0000000000c5ccfe in llvm::SelectionDAGISel::SelectAllBasicBlocks
(this=0x2056090, Fn=...)
    at
/mnt/kmod/pyston_deps/llvm-test/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1236
#12 0x0000000000c591f5 in llvm::SelectionDAGISel::runOnMachineFunction
(this=0x2056090, mf=...)
    at
/mnt/kmod/pyston_deps/llvm-test/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:451
#13 0x00000000009b44d8 in (anonymous
namespace)::X86DAGToDAGISel::runOnMachineFunction (this=0x2056090, MF=...)
    at /mnt/kmod/pyston_deps/llvm-test/lib/Target/X86/X86ISelDAGToDAG.cpp:170
#14 0x0000000000e4cfab in llvm::MachineFunctionPass::runOnFunction
(this=0x2056090, F=...)
    at /mnt/kmod/pyston_deps/llvm-test/lib/CodeGen/MachineFunctionPass.cpp:33
#15 0x0000000001409050 in llvm::FPPassManager::runOnFunction (this=0x20542e0,
F=...)
    at /mnt/kmod/pyston_deps/llvm-test/lib/IR/LegacyPassManager.cpp:1544
#16 0x00000000014091c0 in llvm::FPPassManager::runOnModule (this=0x20542e0,
M=...)
    at /mnt/kmod/pyston_deps/llvm-test/lib/IR/LegacyPassManager.cpp:1564
#17 0x0000000001409514 in (anonymous namespace)::MPPassManager::runOnModule
(this=0x202b4d0, M=...)
    at /mnt/kmod/pyston_deps/llvm-test/lib/IR/LegacyPassManager.cpp:1622
#18 0x0000000001409bbe in llvm::legacy::PassManagerImpl::run (this=0x202b160,
M=...)
    at /mnt/kmod/pyston_deps/llvm-test/lib/IR/LegacyPassManager.cpp:1729
#19 0x0000000001409ddd in llvm::legacy::PassManager::run (this=0x7fffffffd590,
M=...)
    at /mnt/kmod/pyston_deps/llvm-test/lib/IR/LegacyPassManager.cpp:1766
#20 0x0000000000903172 in compileModule (argv=0x7fffffffd9a8, Context=...) at
/mnt/kmod/pyston_deps/llvm-test/tools/llc/llc.cpp:351
#21 0x00000000009023f6 in main (argc=2, argv=0x7fffffffd9a8) at
/mnt/kmod/pyston_deps/llvm-test/tools/llc/llc.cpp:199



I'd be happy to take a crack at this but I'm not sure how to move forward.  It
seems like we shouldn't generate any code to promote the integer arguments and
instead should emit whatever subregister they are in, though I don't think the
stackmap binary format can specify that.  Though I guess in theory the frontend
should know the size of the arguments that it passed?</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>