On Wed, Dec 17, 2025 at 12:26 AM Steve Kargl via Gcc <[email protected]> wrote:
>
> On Tue, Dec 16, 2025 at 11:31:13PM +0100, Florian Weimer wrote:
> > * Steve Kargl via Gcc:
> >
> > > So, my question is "Does -flto simply suppress reporting from
> > > -fopt-info-optall or does -flto actually suppress unrolling,
> > > tree vectorization, and tree auto parallization.
> >
> > Do you supply -fopt-info-optall during linking?
> >
>
> I assume, yes. I build a libraries/objects with
>
> gfortran [options] -c XXXX.f90
> ...
> ar cr libbar.a ${OBJS}
>
> and link the executable image with
>
> gfortran [options] -o foo foo.f90 -lbar
>
> In the above [options] is a list of options and the
> list contains -fopt-info-optall. I added -flto=auto
> to the [options] and now I see opt-info output.
So for a simple
int a[1024];
int main()
{
for (int i = 0; i < 1024; ++i)
a[i] = i;
__builtin_printf ("%d\n", a[513]);
}
I get
> gcc-15 t.c -O3 -fopt-info -flto -c
> gcc-15 t.o -fopt-info
t.c:4:21: optimized: loop vectorized using 16 byte vectors
So it's important to put -fopt-info to the linker line, other
options like -O3 or -flto shouldn't be needed.
Richard.
>
> --
> Steve