On Wed, Dec 17, 2025 at 01:33:02PM +0100, Richard Biener wrote:
> 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.
>
I've solved the mystery. The project uses BSD make(1) instead
of GNU make(1). I had '-flto=auto' in my list of options.
The info files states
Use -flto=auto to use GNU make's job server, if available, or
otherwise fall back to autodetection of the number of CPU threads
present in your system.
It seems that BSD make and -flto-auto do not mix well. If I
simply use -flto in the list of options, I see
% grep -i optimize sgk.log | wc -l
6746
% grep -i optimize sgk.log | grep -i vector | wc -l
1995
% grep -i optimize sgk.log | grep -i parallel | wc -l
448
% grep -i optimize sgk.log | grep -i inline | wc -l
569
% grep -i optimize sgk.log | grep -i inlining | wc -l
58
--
Steve