[LLVMdev] type legalizer promoting BUILD_VECTORs

Eli Friedman eli.friedman at gmail.com
Mon Feb 2 15:50:18 PST 2009


On Mon, Feb 2, 2009 at 3:34 PM, Bob Wilson <bob.wilson at apple.com> wrote:
> If I have a BUILD_VECTOR that creates a v16i8 type, and v16i8 is a
> legal type for the target that does not require any promotion or
> expansion, I would not expect the type legalizer to change it.  But,
> it does.  It looks at the i8 elements and decides that they need to be
> promoted to i32, so it changes the BUILD_VECTOR to create a v4i32
> vector, which is then bitcast back to v16i8.

Ah, this is the code in DAGTypeLegalizer::PromoteIntOp_BUILD_VECTOR.
Thanks for the pointer; this is making a lot more sense now.

I somehow find it surprising that the operands of a BUILD_VECTOR are
required to be the same type as the elements of the resulting vector.
Besides changing that, I don't have any particularly good suggestions.

-Eli



More information about the llvm-dev mailing list