[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:46:27 PST 2022
rnk created this revision.
rnk added reviewers: nickdesaulniers, craig.topper.
Herald added subscribers: pengfei, hiraditya.
rnk requested review of this revision.
Herald added a project: LLVM.
This ensures that the Windows unwinder will work at every instruction
boundary, and allows other targets to read and write flags without
setting up a frame pointer.
Repository:
rG LLVM Github Monorepo
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,8 @@
MF.getInfo<X86MachineFunctionInfo>()->hasPreallocatedCall() ||
MF.callsUnwindInit() || MF.hasEHFunclets() || MF.callsEHReturn() ||
MFI.hasStackMap() || MFI.hasPatchPoint() ||
- MFI.hasCopyImplyingStackAdjustment());
+ (MF.getTarget().getMCAsmInfo()->usesWindowsCFI() &&
+ MFI.hasCopyImplyingStackAdjustment()));
}
static unsigned getSUBriOpcode(bool IsLP64, int64_t Imm) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119391.407345.patch
Type: text/x-patch
Size: 1431 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220210/fe5d2927/attachment-0001.bin>
More information about the llvm-commits
mailing list