[PATCH] Optimize redundant insertvalue instructions

Eric Christopher echristo at gmail.com
Tue May 6 10:24:48 PDT 2014


This is weird, how'd we get here? How aren't we deleting the first one
as dead code? Etc.

-eric

On Tue, May 6, 2014 at 7:42 AM, Michael Zolotukhin
<mzolotukhin at apple.com> wrote:
> Hi,
>
> This patch implements a simple optimization of redundant insertvalue
> instructions.
>
> Here is a small example where it will help:
>   %0 = insertvalue { i8, i32 } undef, i8 %x, 0
>   %1 = insertvalue { i8, i32 } %0,    i8 %y, 0
>
> In this example, the second instruction inserts values at the same indices,
> as the first one, and consequently, the first instruction is redundant.
> This code will be transformed to:
>   %0 = insertvalue { i8, i32 } undef, i8 %y, 0
>
> This optimization catches nothing on specs and test-suite, but the example
> was inspired by a real world application.
>
> As an experiment, I tried a more sophisticated implementation, which was
> capable of dealing with several users and with partially overlapping
> indices, but that also caught nothing on specs (and for my application the
> simple version was enough). If there is an interest, I could share a patch
> with this more complicated implementation as well.
>
> Is it ok to commit this patch?
>
>
>
> Thanks,
> Michael
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>



More information about the llvm-commits mailing list