[LLVMdev] extractvalue and insertvalue on vector types
Duncan Sands
baldrick at free.fr
Wed Dec 14 07:46:04 PST 2011
Hi Andrew,
> If I change the code such that the structure is defined with a
> 2-element array instead of a 2-element vector:
> %struct.s = type {i32,i32,[2 x i32]}
> then llvm-as does not report an error, hence why I believe the problem
> is specific to accessing vector components.
correct, extractvalue doesn't work on vectors, you need to use to use
extractelement for them.
> According to the Language Reference Manual, I should be able to access
> vector components with extractvalue:
>
> "The 'extractvalue' instruction extracts the value of a member field
> from an aggregate value", and "Aggregate Types are a subset of derived
> types that can contain multiple member types. Arrays, structs and
> vectors are aggregate types".
>
> Also:
> "The operands [to extractvalue] are constant indices to specify which
> value to extract in a similar manner as indices in a 'getelementptr'
> instruction", and "subsequent types [indexed by getelementptr] can be
> arrays, vectors, and structs."
These are mistakes in the language ref.
Ciao, Duncan.
> Any pointers as to what I'm doing wrong, or is this a mistake in the
> reference manual? I could believe that you're not meant to use
> extractvalue and insertvalue on vector types, since that would seem to
> duplicate the behaviour of extractelement and insertelement, but, at
> the moment, the manual says that it's allowed.
>
> Andrew
>
>
>
>
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
More information about the llvm-dev
mailing list