> -----Original Message----- > From: Segher Boessenkool <seg...@kernel.crashing.org> > Sent: Wednesday, July 9, 2025 1:13 AM > To: Cui, Lili <lili....@intel.com> > Cc: ubiz...@gmail.com; gcc-patches@gcc.gnu.org; Liu, Hongtao > <hongtao....@intel.com>; richard.guent...@gmail.com; Michael Matz > <m...@suse.de> > Subject: Re: [PATCH V3] x86: Enable separate shrink wrapping > > Hi! > > On Tue, Jul 08, 2025 at 08:51:30AM +0000, Cui, Lili wrote: > > > rs6000 does not *have* a hard frame pointer! > > > > Oh, I see. The handling of HARD_FRAME_POINTER_REGNUM seems > redundant for rs6000. > > The Power Architecture, Power ISA, nor any of our ABIs has a frame pointer. > GCC generic code requires one to exist though (for no reason at all), so when > given -fno-omit-framepointer we dedicate GPR for it (we use 31, I had to look > it up to confirm it even, we never actually want to use it!) > > > Yes, -fomit-frame-pointer does help performance. Here is a simple small > > case > https://godbolt.org/z/5Tc3jM7qc . Do you mean to optimize the %rbp here? > > You tell GCC you want a frame pointer. It follows your instructions. > There is a function call, so the frame pointer is saved before it; the > compiler > does not realise it does not actually use the frame pointer ever, it could > optimise this whole stuff out (that's what in rs6000 the > frame_pointer_needed_indeed thing is for: > frame_pointer_needed_indeed > = frame_pointer_needed > && df_regs_ever_live_p (HARD_FRAME_POINTER_REGNUM); > ) >
I was confused about this case and wondered if it could be optimized, but you enlightened me. I will incorporate this logic into X86 as well. Thanks! :-) Lili. > > Segher