[PATCH] D119391: [X86] Only force FP usage in the presence of pushf/popf on Win64
    Reid Kleckner via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Wed Feb  9 16:54:21 PST 2022
    
    
  
rnk updated this revision to Diff 407351.
rnk added a comment.
- use a helper
Repository:
  rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119391/new/
https://reviews.llvm.org/D119391
Files:
  llvm/lib/Target/X86/X86FrameLowering.cpp
  llvm/test/CodeGen/X86/x86-flags-intrinsics.ll
Index: llvm/test/CodeGen/X86/x86-flags-intrinsics.ll
===================================================================
--- llvm/test/CodeGen/X86/x86-flags-intrinsics.ll
+++ llvm/test/CodeGen/X86/x86-flags-intrinsics.ll
@@ -11,11 +11,9 @@
 }
 
 ; CHECK-LABEL: _read_flags:
-; CHECK:      pushl   %ebp
-; CHECK-NEXT: movl    %esp, %ebp
-; CHECK-NEXT: pushfl
+; CHECK:      pushfl
 ; CHECK-NEXT: popl    %eax
-; CHECK-NEXT: popl    %ebp
+; CHECK-NEXT: retl
 
 define x86_fastcallcc void @write_flags(i32 inreg %arg) {
 entry:
@@ -24,8 +22,6 @@
 }
 
 ; CHECK-LABEL: @write_flags at 4:
-; CHECK:      pushl   %ebp
-; CHECK-NEXT: movl    %esp, %ebp
-; CHECK-NEXT: pushl   %ecx
+; CHECK:      pushl   %ecx
 ; CHECK-NEXT: popfl
-; CHECK-NEXT: popl    %ebp
+; CHECK-NEXT: retl
Index: llvm/lib/Target/X86/X86FrameLowering.cpp
===================================================================
--- llvm/lib/Target/X86/X86FrameLowering.cpp
+++ llvm/lib/Target/X86/X86FrameLowering.cpp
@@ -100,7 +100,7 @@
           MF.getInfo<X86MachineFunctionInfo>()->hasPreallocatedCall() ||
           MF.callsUnwindInit() || MF.hasEHFunclets() || MF.callsEHReturn() ||
           MFI.hasStackMap() || MFI.hasPatchPoint() ||
-          MFI.hasCopyImplyingStackAdjustment());
+          (isWin64Prologue(MF) && MFI.hasCopyImplyingStackAdjustment()));
 }
 
 static unsigned getSUBriOpcode(bool IsLP64, int64_t Imm) {
@@ -1385,6 +1385,9 @@
   return Is64Bit && !IsWin64CC && !Fn.hasFnAttribute(Attribute::NoRedZone);
 }
 
+/// Return true if we need to use the restricted Windows x64 prologue and
+/// epilogue code patterns that can be described with WinCFI (.seh_*
+/// directives).
 bool X86FrameLowering::isWin64Prologue(const MachineFunction &MF) const {
   return MF.getTarget().getMCAsmInfo()->usesWindowsCFI();
 }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119391.407351.patch
Type: text/x-patch
Size: 1795 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220210/272614f0/attachment.bin>
    
    
More information about the llvm-commits
mailing list