|
2 | 2 | ; RUN: llc < %s -mtriple=i686-windows -no-x86-call-frame-opt | FileCheck %s -check-prefix=NOPUSH
|
3 | 3 | ; RUN: llc < %s -mtriple=x86_64-windows | FileCheck %s -check-prefix=X64
|
4 | 4 | ; RUN: llc < %s -mtriple=i686-windows -stackrealign -stack-alignment=32 | FileCheck %s -check-prefix=ALIGNED
|
| 5 | +; RUN: llc < %s -mtriple=i686-pc-linux | FileCheck %s -check-prefix=LINUX |
5 | 6 |
|
6 | 7 | %class.Class = type { i32 }
|
7 | 8 | %struct.s = type { i64 }
|
@@ -223,8 +224,7 @@ entry:
|
223 | 224 | ; NORMAL-NEXT: pushl $2
|
224 | 225 | ; NORMAL-NEXT: pushl $1
|
225 | 226 | ; NORMAL-NEXT: call
|
226 |
| -; NORMAL-NEXT: addl $16, %esp |
227 |
| -; NORMAL-NEXT: subl $20, %esp |
| 227 | +; NORMAL-NEXT: subl $4, %esp |
228 | 228 | ; NORMAL-NEXT: movl 20(%esp), [[E1:%e..]]
|
229 | 229 | ; NORMAL-NEXT: movl 24(%esp), [[E2:%e..]]
|
230 | 230 | ; NORMAL-NEXT: movl [[E2]], 4(%esp)
|
@@ -261,7 +261,7 @@ entry:
|
261 | 261 | ; NORMAL-NEXT: pushl $2
|
262 | 262 | ; NORMAL-NEXT: pushl $1
|
263 | 263 | ; NORMAL-NEXT: calll *16(%esp)
|
264 |
| -; NORMAL-NEXT: addl $16, %esp |
| 264 | +; NORMAL-NEXT: addl $24, %esp |
265 | 265 | define void @test10() optsize {
|
266 | 266 | %stack_fptr = alloca void (i32, i32, i32, i32)*
|
267 | 267 | store void (i32, i32, i32, i32)* @good, void (i32, i32, i32, i32)** %stack_fptr
|
@@ -314,8 +314,7 @@ entry:
|
314 | 314 | ; NORMAL-NEXT: pushl $2
|
315 | 315 | ; NORMAL-NEXT: pushl $1
|
316 | 316 | ; NORMAL-NEXT: calll _good
|
317 |
| -; NORMAL-NEXT: addl $16, %esp |
318 |
| -; NORMAL-NEXT: subl $20, %esp |
| 317 | +; NORMAL-NEXT: subl $4, %esp |
319 | 318 | ; NORMAL: movl $8, 16(%esp)
|
320 | 319 | ; NORMAL-NEXT: movl $7, 12(%esp)
|
321 | 320 | ; NORMAL-NEXT: movl $6, 8(%esp)
|
@@ -358,3 +357,27 @@ entry:
|
358 | 357 | call void @good(i32 %val1, i32 %val2, i32 %val3, i32 %add)
|
359 | 358 | ret i32* %ptr3
|
360 | 359 | }
|
| 360 | + |
| 361 | +; Make sure to fold adjacent stack adjustments. |
| 362 | +; LINUX-LABEL: pr27140: |
| 363 | +; LINUX: subl $12, %esp |
| 364 | +; LINUX: .cfi_def_cfa_offset 16 |
| 365 | +; LINUX-NOT: sub |
| 366 | +; LINUX: pushl $4 |
| 367 | +; LINUX: .cfi_adjust_cfa_offset 4 |
| 368 | +; LINUX: pushl $3 |
| 369 | +; LINUX: .cfi_adjust_cfa_offset 4 |
| 370 | +; LINUX: pushl $2 |
| 371 | +; LINUX: .cfi_adjust_cfa_offset 4 |
| 372 | +; LINUX: pushl $1 |
| 373 | +; LINUX: .cfi_adjust_cfa_offset 4 |
| 374 | +; LINUX: calll good |
| 375 | +; LINUX: addl $28, %esp |
| 376 | +; LINUX: .cfi_adjust_cfa_offset -28 |
| 377 | +; LINUX-NOT: add |
| 378 | +; LINUX: retl |
| 379 | +define void @pr27140() optsize { |
| 380 | +entry: |
| 381 | + tail call void @good(i32 1, i32 2, i32 3, i32 4) |
| 382 | + ret void |
| 383 | +} |
0 commit comments