[llvm-commits] [Review request] Instcombine: extractvalue from load --> load from gep

Frits van Bommel fvbommel at gmail.com
Mon Nov 29 12:28:35 PST 2010


On Mon, Nov 29, 2010 at 8:20 PM, Dan Gohman <gohman at apple.com> wrote:
> On Nov 28, 2010, at 2:43 AM, Frits van Bommel wrote:
>
>> <006-instcombine-extractvalue-load-v3.patch><007-instcombine-extractvalue-load-test-v2.patch>_______________________________________________
>
> Why is this needed? Front-ends should emit gep+load instead of
> load+extractvalue.

Not all front ends might do that. For instance, it might load both
fields of a struct if thinks it's going to need them anyway but then
one gets optimized out.

Also, when I accidentally messed this up so it asserted every time it
fired clang could no longer compile LLVM. I think the problem was in
the passmanager, but I might be misremembering.
Anyway, I bugpointed it to a file that contained several instances of
this pattern so apparently it *does* occur for clang-generated code. I
didn't investigate where they came from, but maybe some other
optimization pass is generating extractvalue instructions?

Honestly, the main reason I did this was because I was bored and
disagreed with the comment, but apparently it does occur in real
code...



More information about the llvm-commits mailing list