PING^2 [PATCH/RFC] Add a new memory gathering optimization for loop (PR98598)

Feng Xue OS
Fri Apr 2 05:44:57 GMT 2021

Made some minor changes to this patch. It has been a long silent time
since initial review request. Could someone take a look at this patch? Basic
idea about the optimization was posted as the RFC


From: Feng Xue OS
Sent: Thursday, January 21, 2021 2:27 PM
Cc: JiangNing OS; Hao Liu OS
Subject: [PATCH/RFC] Add a new memory gathering optimization for loop (PR98598)

This patch implements a new loop optimization according to the proposal
in RFC given at
So do not repeat the idea in this mail. Hope your comments on it.

Bootstrapped/regtested on x86_64-linux and aarch64-linux.


2020-12-25  Feng Xue  <>

        PR tree-optimization/98598
        * (OBJS): Add tree-ssa-loop-mgo.o.
        * common.opt (-ftree-loop-mgo): New option.
        * opts.c (default_options_table): Enable -ftree-loop-mgo at -O3+.
        * params.opt (mgo-max-dep-load-level): New parameter.
        (mgo-max-cache-elem-size): Likewise.
        (mgo-min-cache-array-length): Likewise.
        (mgo-max-cache-array-length): Likewise.
        * doc/invoke.texi (mgo-max-dep-load-level): Document new parameter.
        (mgo-max-cache-elem-size): Likewise.
        (mgo-min-cache-array-length): Likewise.
        (mgo-max-cache-array-length): Likewise.
        * passes.def: Add new pass_loop_mgo pass.
        * timevar.def (TV_LOOP_MGO): New timevar.
        * tree-pass.h (make_pass_loop_mgo): New declaration.
        * tree-ssa-loop-mgo.c: New file.

        PR tree-optimization/98598
        * gcc.dg/tree-ssa/mgo/mgo.exp: New file.
        * gcc.dg/tree-ssa/mgo/mgo-common.h: New test header.
        * gcc.dg/tree-ssa/mgo/list/list-1.c: New test.
        * gcc.dg/tree-ssa/mgo/array/simple-1.c: Likewise.
        * gcc.dg/tree-ssa/mgo/array/simple-2.c: Likewise.
        * gcc.dg/tree-ssa/mgo/array/simple-3.c: Likewise.
        * gcc.dg/tree-ssa/mgo/array/param-1.c: Likewise.
        * gcc.dg/tree-ssa/mgo/array/param-2.c: Likewise.
        * gcc.dg/tree-ssa/mgo/array/param-3.c: Likewise.
        * gcc.dg/tree-ssa/mgo/array/dep-load-1.c: Likewise.
        * gcc.dg/tree-ssa/mgo/array/dep-load-2.c: Likewise.
        * gcc.dg/tree-ssa/mgo/array/dep-load-3.c: Likewise.
        * gcc.dg/tree-ssa/mgo/array/dep-load-4.c: Likewise.
        * gcc.dg/tree-ssa/mgo/array/dep-load-5.c: Likewise.
        * gcc.dg/tree-ssa/mgo/array/dep-load-6.c: Likewise.
        * gcc.dg/tree-ssa/mgo/array/dep-load-7.c: Likewise.
        * gcc.dg/tree-ssa/mgo/array/dep-load-8.c: Likewise.
        * gcc.dg/tree-ssa/mgo/array/dep-load-9.c: Likewise.
        * gcc.dg/tree-ssa/mgo/array/dep-load-10.c: Likewise.
        * gcc.dg/tree-ssa/mgo/array/indx-iter-1.c: Likewise.
        * gcc.dg/tree-ssa/mgo/array/indx-iter-2.c: Likewise.
        * gcc.dg/tree-ssa/mgo/array/indx-iter-3.c: Likewise.
        * gcc.dg/tree-ssa/mgo/array/indx-iter-4.c: Likewise.
        * gcc.dg/tree-ssa/mgo/array/indx-iter-5.c: Likewise.
        * gcc.dg/tree-ssa/mgo/array/indx-iter-6.c: Likewise.
        * gcc.dg/tree-ssa/mgo/array/outer-loop-1.c: Likewise.
        * gcc.dg/tree-ssa/mgo/array/outer-loop-2.c: Likewise.
        * gcc.dg/tree-ssa/mgo/array/outer-loop-3.c: Likewise.
        * gcc.dg/tree-ssa/mgo/array/outer-loop-4.c: Likewise.
        * gcc.dg/tree-ssa/mgo/array/outer-loop-5.c: Likewise.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mgo-Add-a-new-memory-gathering-optimization-for-loop.patch
Type: text/x-patch
Size: 124475 bytes
Desc: mgo-Add-a-new-memory-gathering-optimization-for-loop.patch
URL: <>

More information about the Gcc-patches mailing list