[PATCH] Fix incorrect example for insertvalue instruction in LangRef

Sean Silva chisophugis at gmail.com
Mon Sep 8 14:00:59 PDT 2014


LGTM.

On Mon, Sep 8, 2014 at 2:20 AM, Dan Liew <dan at su-root.co.uk> wrote:

> Hi Sean,
>
> This patch fixes a mistake in the insertvalue instruction example.
> Trying to assemble this with llvm-as
>
> ```
> define void @main(float %val)
> {
>     %agg1 = insertvalue {i32, float} undef, i32 1, 0              ;
> yields {i32 1, float undef}
>     %agg2 = insertvalue {i32, float} %agg1, float %val, 1         ;
> yields {i32 1, float %val}
>     %agg3 = insertvalue {i32, {float}} %agg1, float %val, 1, 0    ;
> yields {i32 undef, float %val}
>     ret void
> }
> ```
>
> gives the following error
>
> ```
> llvm-as: agg.ll:5:40: error: '%agg1' defined with type '{ i32, float }'
>     %agg3 = insertvalue {i32, {float}} %agg1, float %val, 1, 0    ;
> yields {i32 undef, float %val}
> ```
>
> Which isn't surprising because {i32, {float}} and {i32, float} are not
> the same type.
>
> Using my modified version assembles without error so I think what I've
> done is correct.
>
> Is this okay to commit?
>
> Thanks,
> Dan.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140908/a00e198e/attachment.html>


More information about the llvm-commits mailing list