[llvm] r275431 - Don't optimize movs to pushes in -O0 builds.
Nico Weber via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 14 08:40:23 PDT 2016
Author: nico
Date: Thu Jul 14 10:40:22 2016
New Revision: 275431
URL: http://llvm.org/viewvc/llvm-project?rev=275431&view=rev
Log:
Don't optimize movs to pushes in -O0 builds.
https://reviews.llvm.org/D22362
Modified:
llvm/trunk/lib/Target/X86/X86TargetMachine.cpp
llvm/trunk/test/CodeGen/X86/fast-isel-call.ll
llvm/trunk/test/CodeGen/X86/win32_sret.ll
Modified: llvm/trunk/lib/Target/X86/X86TargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetMachine.cpp?rev=275431&r1=275430&r2=275431&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86TargetMachine.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86TargetMachine.cpp Thu Jul 14 10:40:22 2016
@@ -307,9 +307,9 @@ void X86PassConfig::addPreRegAlloc() {
if (getOptLevel() != CodeGenOpt::None) {
addPass(createX86FixupSetCC());
addPass(createX86OptimizeLEAs());
+ addPass(createX86CallFrameOptimization());
}
- addPass(createX86CallFrameOptimization());
addPass(createX86WinAllocaExpander());
}
Modified: llvm/trunk/test/CodeGen/X86/fast-isel-call.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/fast-isel-call.ll?rev=275431&r1=275430&r2=275431&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/fast-isel-call.ll (original)
+++ llvm/trunk/test/CodeGen/X86/fast-isel-call.ll Thu Jul 14 10:40:22 2016
@@ -23,12 +23,12 @@ define void @test2(%struct.s* %d) nounwi
call void @foo2(%struct.s* byval %d )
ret void
; CHECK-LABEL: test2:
-; CHECK: movl (%eax), %[[reg1:e[a-d]x]]
-; CHECK: movl 4(%eax), %[[reg2:e[a-d]x]]
-; CHECK: movl 8(%eax), %[[reg3:e[a-d]x]]
-; CHECK: pushl %[[reg3]]
-; CHECK: pushl %[[reg2]]
-; CHECK: pushl %[[reg1]]
+; CHECK: movl (%eax), %ecx
+; CHECK: movl %ecx, (%esp)
+; CHECK: movl 4(%eax), %ecx
+; CHECK: movl %ecx, 4(%esp)
+; CHECK: movl 8(%eax), %eax
+; CHECK: movl %eax, 8(%esp)
}
declare void @llvm.memset.p0i8.i32(i8* nocapture, i8, i32, i32, i1) nounwind
Modified: llvm/trunk/test/CodeGen/X86/win32_sret.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/win32_sret.ll?rev=275431&r1=275430&r2=275431&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/win32_sret.ll (original)
+++ llvm/trunk/test/CodeGen/X86/win32_sret.ll Thu Jul 14 10:40:22 2016
@@ -139,7 +139,7 @@ entry:
; (through %ecx in the -O0 build).
; WIN32: leal {{[0-9]*}}(%esp), %e{{[a-d]}}x
; WIN32: leal {{[0-9]*}}(%esp), %ecx
-; WIN32: pushl %e{{[a-d]}}x
+; WIN32: {{pushl %e[a-d]x|movl %e[a-d]x, \(%esp\)}}
; WIN32-NEXT: calll "?foo at C5@@QAE?AUS5@@XZ"
; WIN32: retl
ret void
@@ -154,21 +154,21 @@ define void @test6_f(%struct.test6* %x)
; LINUX-LABEL: test6_f:
; The %x argument is moved to %ecx. It will be the this pointer.
-; WIN32: movl 16(%esp), %ecx
+; WIN32: movl {{16|20}}(%esp), %ecx
; The sret pointer is (%esp)
-; WIN32: leal (%esp), %[[REG:e[a-d]x]]
-; WIN32-NEXT: pushl %[[REG]]
+; WIN32: leal {{4?}}(%esp), %eax
+; WIN32-NEXT: {{pushl %eax|movl %eax, \(%esp\)}}
; The sret pointer is %ecx
; The %x argument is moved to (%esp). It will be the this pointer.
-; MINGW_X86: leal (%esp), %ecx
-; MINGW_X86-NEXT: pushl 16(%esp)
+; MINGW_X86: leal {{4?}}(%esp), %ecx
+; MINGW_X86-NEXT: {{pushl 16\(%esp\)|movl %eax, \(%esp\)}}
; MINGW_X86-NEXT: calll _test6_g
-; CYGWIN: leal (%esp), %ecx
-; CYGWIN-NEXT: pushl 16(%esp)
+; CYGWIN: leal {{4?}}(%esp), %ecx
+; CYGWIN-NEXT: {{pushl 16\(%esp\)|movl %eax, \(%esp\)}}
; CYGWIN-NEXT: calll _test6_g
%tmp = alloca %struct.test6, align 4
@@ -186,17 +186,17 @@ define void @test7_f(%struct.test7* %x)
; LINUX-LABEL: test7_f:
; The %x argument is moved to %ecx on all OSs. It will be the this pointer.
-; WIN32: movl 16(%esp), %ecx
-; MINGW_X86: movl 16(%esp), %ecx
-; CYGWIN: movl 16(%esp), %ecx
+; WIN32: movl {{16|20}}(%esp), %ecx
+; MINGW_X86: movl {{16|20}}(%esp), %ecx
+; CYGWIN: movl {{16|20}}(%esp), %ecx
; The sret pointer is (%esp)
-; WIN32: leal (%esp), %[[REG:e[a-d]x]]
-; WIN32-NEXT: pushl %[[REG]]
-; MINGW_X86: leal (%esp), %[[REG:e[a-d]x]]
-; MINGW_X86-NEXT: pushl %[[REG]]
-; CYGWIN: leal (%esp), %[[REG:e[a-d]x]]
-; CYGWIN-NEXT: pushl %[[REG]]
+; WIN32: leal {{4?}}(%esp), %eax
+; WIN32-NEXT: {{pushl %eax|movl %eax, \(%esp\)}}
+; MINGW_X86: leal {{4?}}(%esp), %eax
+; MINGW_X86-NEXT: {{pushl %eax|movl %eax, \(%esp\)}}
+; CYGWIN: leal {{4?}}(%esp), %eax
+; CYGWIN-NEXT: {{pushl %eax|movl %eax, \(%esp\)}}
%tmp = alloca %struct.test7, align 4
call x86_thiscallcc void @test7_g(%struct.test7* %x, %struct.test7* sret %tmp)
More information about the llvm-commits
mailing list