Bug in SelectionDAGBuild.cpp?

I'm hitting a problem in SelectionDAGBuild::visitRet(), mainly:

MVT VT = ValueVTs[j];

// FIXME: C calling convention requires the return type to be promoted

      // at least 32-bit. But this is not necessary for non-C calling

      // conventions.

      if (VT.isInteger()) {

        MVT MinVT = TLI.getRegisterType(MVT::i32);

        if (VT.bitsLT(MinVT))

          VT = MinVT;


This is occurring when VT is a 16bit vector type,<2x i8>. LLVM is then
changing it to be a 32bit type and

it asserts in :

getCopyToParts(DAG, SDValue(RetOp.getNode(), RetOp.getResNo() + j),

                     &Parts[0], NumParts, PartVT, ExtendKind);


assert(ValueVT.getVectorElementType() == PartVT &&

               ValueVT.getVectorNumElements() == 1 &&

               "Only trivial vector-to-scalar conversions should get

Because it switched PartVT from a vector type<2xi8> into a scalar

Any idea's on how I can get around this constraint?


Micah Villmow

Systems Engineer

Advanced Technology & Performance

Advanced Micro Devices Inc.

S1-609 One AMD Place

Sunnyvale, CA. 94085

P: 408-749-3966