This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH: PR/40314] extract common address for memory access to fields of large struct

Steven Bosscher <> writes:

> On Wed, Jun 3, 2009 at 8:59 AM, Carrot Wei<> wrote:
>> I've tested CSiBE, nearly no changes to code size and compile time. It
>> seems there is no large structure in CSiBE to trigger this
>> optimization. For mcf from CPU SPEC 2006, this optimization can reduce
>> about 7% static instructions.
> Alright, counts as an improvement worth pursuing.
> What I was wondering though -- isn't this just a special case of Adam
> Nemet's "constant anchor" additions to CSE?

No, but I think the existing related-value optimization in CSE might be
able to handle this.  You just need to avoid propagating the addition
into the mem.  I.e. instead of:

(set r200 400)                     # 400 is offset of field1
(set r201 (mem (plus r100 r200)))  # r100 contains struct base
(set r300 404)                     # 404 is offset of field2
(set r301 (mem (plus r100 r300)))  # r100 contains struct base

start with:

(set r200 400)
(set t1 (plus r100 r200))
(set r201 (mem t1))
(set r300 404)
(set t2 (plus r100 r300))
(set r301 (mem t2))

then t2 should be expressed with as t1 + 4 as a related value
(hopefully!) and then fwprop can now propagate into both mems.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]