Re: Is PRE architecture dependent? aarch64 vs x86_64

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 14, 2025 at 05:01:40PM -0400, Bradley Lucier wrote:
> On 7/14/25 16:30, Segher Boessenkool wrote:
> > PRE is run whenever you use -fgcse, to a first order approximation 🙂
> > The biggest contraindication is functions that call setjmp, those will
> > never get PRE done.
> 
> On both aarch64 and x86_64 -fno-gcse flag is given as a gcc command line
> argument; the typical call is

Oh!  Then you do not get PRE at all of course.

bool
pass_rtl_pre::gate (function *fun)
{
  return optimize > 0 && flag_gcse
    && !fun->calls_setjmp
    && optimize_function_for_speed_p (fun)
    && dbg_cnt (pre);
}

No -fgcse -> no PRE.

> /pkgs/gcc-15.1.0/bin/gcc -save-temps -O1 -fexpensive-optimizations -fno-gcse
> --param max-gcse-memory=400000 -Wno-unused -Wno-write-strings

-fno-gcse is the default at -O1 anyway.  You need -O2 to get reasonable
optimisation.

> -Wdisabled-optimization -fwrapv -fno-strict-aliasing -fno-trapping-math

-fwrapv is a great way to get slower code, too.  Is there something in
your code that does not work without this reality-distorting flag?

Similar for -fno-strict-aliasing.

> So maybe with this combination of flags, PRE is run on aarch64 and not on
> x86_64, and there's no mystery.

It should not run on *any* arch with -fno-gcse, and that is the default
at -O1 anyway!


Segher



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux