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: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to