[LLVMdev] ISD::VAARG and DAGTypeLegalizer::WidenVectorResult

Martin J. O'Riordan Martin.ORiordan at Movidius.com
Mon Feb 16 07:25:23 PST 2015


I am trying to debug a crash (llvm_unreachable) where
'DAGTypeLegalizer::WidenVectorResult' is being called with an SDNode of type
'ISD::VAARG' for a vector of type 'v2i32'.  This node type is not handled in
this function, so I am assuming something is broken even earlier.

The target does not support 'v2i32' as a native vector type, but it does
support a native 'v4i32'.  I have configured
'MYTargetLowering::getPreferredVectorAction' to return 'TypeWidenVector',
but this does not seem to help.  I have also tried various methods in
'MYTargetLowering::ReplaceNodeResults' but this doesn't help either.

It looks like the type should have already been widened by the time it gets
to 'DAGTypeLegalizer::WidenVectorResult', but I cannot see why this is not
happening.  It is also strange that a VAARG node is getting this far too.

The caller side pushes the 'v2i32' on the stack as a 'v4i32' as expected
(with two elements of rubbish), but when 'va_arg' is used in the callee for
the type 'v2i32' it fails in this way.

This happens for all vectors that do not match a native vector, so it
applies to vectors that should be widened and vectors that should be split.

It is probably a fairly strange thing to do passing vectors to variadic
functions, but it occurs in the OpenCL variant of 'printf'.

Has anybody seen this kind of problem before, and have any recommendations I
could use to identify the cause of this problem so that I can figure out
where best to fix it?

Thanks,

	Martin O'Riordan (Movidius Ltd.)





More information about the llvm-dev mailing list