[PATCH] D77031: [X86] make sure POP has implicit def/use of stack pointer when materializing 8-bit immediates for minsize
Yuanfang Chen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 30 09:44:44 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGece79f47083b: [X86] make sure POP has implicit def/use of stack pointer when materializing 8… (authored by ychen).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77031/new/
https://reviews.llvm.org/D77031
Files:
llvm/lib/Target/X86/X86InstrInfo.cpp
llvm/test/CodeGen/X86/materialize.ll
Index: llvm/test/CodeGen/X86/materialize.ll
===================================================================
--- llvm/test/CodeGen/X86/materialize.ll
+++ llvm/test/CodeGen/X86/materialize.ll
@@ -2,6 +2,13 @@
; RUN: llc -mtriple=x86_64-unknown-linux-gnu -mattr=+cmov %s -o - | FileCheck %s --check-prefix=CHECK64
; RUN: llc -mtriple=x86_64-pc-win32 -mattr=+cmov %s -o - | FileCheck %s --check-prefix=CHECKWIN64
+; RUN: llc -mtriple=i686-unknown-linux-gnu -mattr=+cmov %s -o /dev/null \
+; RUN: -print-after postrapseudos -filter-print-funcs pr26023 2>&1 \
+; RUN: | FileCheck %s --check-prefix=OPERAND32
+; RUN: llc -mtriple=x86_64-unknown-linux-gnu -mattr=+cmov %s -o /dev/null \
+; RUN: -print-after postrapseudos -filter-print-funcs one64_minsize 2>&1 \
+; RUN: | FileCheck %s --check-prefix=OPERAND64
+
define i32 @one32_nooptsize() {
entry:
ret i32 1
@@ -92,6 +99,12 @@
; CHECK32: pushl $5
; CHECK32: popl %ecx
; CHECK32: retl
+
+; Check push/pop have implicit def/use of $esp
+; OPERAND32: PUSH32i8 5, implicit-def $esp, implicit $esp
+; OPERAND32-NEXT: CFI_INSTRUCTION adjust_cfa_offset 4
+; OPERAND32-NEXT: renamable $ecx = POP32r implicit-def $esp, implicit $esp
+; OPERAND32-NEXT: CFI_INSTRUCTION adjust_cfa_offset -4
}
@@ -110,6 +123,13 @@
; CHECKWIN64-LABEL: one64_minsize:
; CHECKWIN64: movl $1, %eax
; CHECKWIN64-NEXT: retq
+
+; Check push/pop have implicit def/use of $rsp
+; OPERAND64: PUSH64i8 1, implicit-def $rsp, implicit $rsp
+; OPERAND64-NEXT: CFI_INSTRUCTION adjust_cfa_offset 8
+; OPERAND64-NEXT: $rax = POP64r implicit-def $rsp, implicit $rsp
+; OPERAND64-NEXT: CFI_INSTRUCTION adjust_cfa_offset -8
+; OPERAND64-NEXT: RET 0, $rax
}
define i32 @minus_one32() optsize {
Index: llvm/lib/Target/X86/X86InstrInfo.cpp
===================================================================
--- llvm/lib/Target/X86/X86InstrInfo.cpp
+++ llvm/lib/Target/X86/X86InstrInfo.cpp
@@ -4443,6 +4443,8 @@
BuildMI(MBB, I, DL, TII.get(X86::PUSH32i8)).addImm(Imm);
MIB->setDesc(TII.get(X86::POP32r));
}
+ MIB->RemoveOperand(1);
+ MIB->addImplicitDefUseOperands(*MBB.getParent());
// Build CFI if necessary.
MachineFunction &MF = *MBB.getParent();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77031.253619.patch
Type: text/x-patch
Size: 2246 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200330/64dc7fac/attachment-0001.bin>
More information about the llvm-commits
mailing list