[PATCH] D92695: [X86ISelLowering] don't emit frame pointers for eflags intrinsics.

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 15 10:07:57 PST 2021


rnk added inline comments.


================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:25975-25976
-      // sequence.
-      MachineFrameInfo &MFI = DAG.getMachineFunction().getFrameInfo();
-      MFI.setHasCopyImplyingStackAdjustment(true);
       // Don't do anything here, we will expand these intrinsics out later
----------------
pengfei wrote:
> craig.topper wrote:
> > pengfei wrote:
> > > How about address Craig and Reid's concerns by adding the check conditions like above?
> > emitPrologue calls setUsesRedZone. That would occur after this code runs. This is too early to call getUsesRedZone.
> Maybe we can check for `-mno-red-zone` only given Linux kernel is built with it:
> ```
> MachineFunction &MF = DAG.getMachineFunction();
> if (!MF.getFunction().hasFnAttribute(Attribute::NoRedZone))
>   MF.getFrameInfo().setHasCopyImplyingStackAdjustment(true);
> ```
I would try to tackle this the other way around: usage of readflags/writeflags should prevent PEI from enabling the redzone optimization.

I think what we really want here is to tweak X86FrameLowering::hasFP.
If WinCFI is being used, where we have per-instruction accurate CFI, we need to force the use of a frame pointer.
For Linux, this flag should prevent the use of a red zone later in X86FrameLowering::emitProlog. We don't need to force FP usage if WinCFI is not in use.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92695/new/

https://reviews.llvm.org/D92695



More information about the llvm-commits mailing list