[LLVMbugs] [Bug 21548] New: Assertion failed: (!VT.isSimple() || (unsigned)VT.getSimpleVT().SimpleTy < array_lengthof(RegClassForVT)), function isTypeLegal

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Nov 12 10:53:54 PST 2014


http://llvm.org/bugs/show_bug.cgi?id=21548

            Bug ID: 21548
           Summary: Assertion failed: (!VT.isSimple() ||
                    (unsigned)VT.getSimpleVT().SimpleTy <
                    array_lengthof(RegClassForVT)), function isTypeLegal
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: grosbach at apple.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 13326
  --> http://llvm.org/bugs/attachment.cgi?id=13326&action=edit
testcase from llvm-stress

CodeGenPrepare tries to sink shift and truncate instructions into the basic
block of their users heuristically. It fails, however, in the case of a
truncate to i1 which is then fed into a select of pointers.

  %Tr = trunc i32 %B to i1
...
  %Sl54 = select i1 %Tr, i64* %A1, i64* %2

The check in SinkShiftAndTruncate() for CodeGenPrepare.cpp calls:
if (TLI.isOperationLegalOrCustom(ISDOpcode, EVT::getEVT(TruncUser->getType(),
true)))

When the type is iPTR, that check goes badly (at least for AArch64). There's
even a relevant FIXME right above which is related.
    // If the use is actually a legal node, there will not be an                
    // implicit truncate.                                                       
    // FIXME: always querying the result type is just an                        
    // approximation; some nodes' legality is determined by the                 
    // operand or other means. There's no good way to find out though.


Either that conditional needs to handle SELECT directly (likely, since the
result type is unrelated to the heuristic when the operand from the trunc is
the conditional) and/or the lower level isTypeLegal() check should know what to
do with iPTR.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20141112/f6a9654c/attachment.html>


More information about the llvm-bugs mailing list