[llvm-commits] [llvm] r160602 - in /llvm/trunk: lib/Transforms/IPO/GlobalOpt.cpp test/Transforms/GlobalOpt/2009-11-16-BrokenPerformHeapAllocSRoA.ll test/Transforms/GlobalOpt/cleanup-pointer-root-users.ll

Nick Lewycky nicholas at mxc.ca
Wed Jul 25 18:55:11 PDT 2012


Duncan Sands wrote:
> Hi Nick,
>
>>> Because you get to eliminate lots of stores, i.e. all those that
>>> don't have
>>> pointer type?
>>
>> I don't get it, isn't that what we do now? If the global has pointer
>> type then
>> all the stores have to be pointer typed or else the IR is invalid.
>
> maybe I misread your patch, but it seemed to me that you disable the
> optimization for an entire global of struct type if any field in it has
> pointer type. I'm in essence suggesting keeping the optimization for all
> fields except those of pointer type.

Of course! That makes tons of sense.

Yes, we can attack this, possibly by breaking the struct apart (subject 
to which fields are read as first-class aggregates) using the existing 
SRoA code in GlobalOpt.

It's non-trivial to do, even in the simple case of tracking 
getelementptr and figuring out which field is being accessed, but it can 
be done. Do you have a particular testcase in mind?

Nick



More information about the llvm-commits mailing list