[PATCH] D82867: Fix tail allocation for large static alloca
serge via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 30 05:23:21 PDT 2020
serge-sans-paille created this revision.
serge-sans-paille added a reviewer: craig.topper.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
serge-sans-paille marked an inline comment as done.
serge-sans-paille added inline comments.
================
Comment at: llvm/test/CodeGen/X86/stack-clash-large.ll:46
; CHECK-X86-32-NEXT:# %bb.2:
-; CHECK-X86-32-NEXT: movl %r11d, %esp
; CHECK-X86-32-NEXT: .cfi_def_cfa_offset 72016
----------------
This `mov` wasn't relevant, as `%r11d` was clipped.
https://reviews.llvm.org/D82867
Files:
llvm/lib/Target/X86/X86FrameLowering.cpp
llvm/test/CodeGen/X86/stack-clash-large.ll
Index: llvm/test/CodeGen/X86/stack-clash-large.ll
===================================================================
--- llvm/test/CodeGen/X86/stack-clash-large.ll
+++ llvm/test/CodeGen/X86/stack-clash-large.ll
@@ -24,7 +24,7 @@
; CHECK-X86-64-NEXT: cmpq %r11, %rsp
; CHECK-X86-64-NEXT: jl .LBB0_1
; CHECK-X86-64-NEXT:# %bb.2:
-; CHECK-X86-64-NEXT: movq %r11, %rsp
+; CHECK-X86-64-NEXT: subq $2248, %rsp
; CHECK-X86-64-NEXT: .cfi_def_cfa_offset 71888
; CHECK-X86-64-NEXT: movl $1, 264(%rsp)
; CHECK-X86-64-NEXT: movl $1, 28664(%rsp)
@@ -43,7 +43,7 @@
; CHECK-X86-32-NEXT: cmpl %r11d, %esp
; CHECK-X86-32-NEXT: jl .LBB0_1
; CHECK-X86-32-NEXT:# %bb.2:
-; CHECK-X86-32-NEXT: movl %r11d, %esp
+; CHECK-X86-32-NEXT: subl $2380, %esp
; CHECK-X86-32-NEXT: .cfi_def_cfa_offset 72016
; CHECK-X86-32-NEXT: movl $1, 392(%esp)
; CHECK-X86-32-NEXT: movl $1, 28792(%esp)
Index: llvm/lib/Target/X86/X86FrameLowering.cpp
===================================================================
--- llvm/lib/Target/X86/X86FrameLowering.cpp
+++ llvm/lib/Target/X86/X86FrameLowering.cpp
@@ -686,10 +686,12 @@
MBB.addSuccessor(testMBB);
// handle tail
- if (Offset % StackProbeSize) {
- BuildMI(*tailMBB, tailMBB->begin(), DL, TII.get(TargetOpcode::COPY),
- StackPtr)
- .addReg(FinalStackPtr)
+ unsigned TailOffset = Offset % StackProbeSize;
+ if (TailOffset) {
+ const unsigned Opc = getSUBriOpcode(Uses64BitFramePtr, TailOffset);
+ BuildMI(*tailMBB, tailMBB->begin(), DL, TII.get(Opc), StackPtr)
+ .addReg(StackPtr)
+ .addImm(TailOffset)
.setMIFlag(MachineInstr::FrameSetup);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82867.274428.patch
Type: text/x-patch
Size: 1677 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200630/51d48095/attachment-0001.bin>
More information about the llvm-commits
mailing list