diff --git a/llvm/lib/CodeGen/ShrinkWrap.cpp b/llvm/lib/CodeGen/ShrinkWrap.cpp --- a/llvm/lib/CodeGen/ShrinkWrap.cpp +++ b/llvm/lib/CodeGen/ShrinkWrap.cpp @@ -53,6 +53,7 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/Statistic.h" #include "llvm/Analysis/CFG.h" +#include "llvm/Analysis/ValueTracking.h" #include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/CodeGen/MachineBlockFrequencyInfo.h" #include "llvm/CodeGen/MachineDominators.h" @@ -259,13 +260,27 @@ bool ShrinkWrap::useOrDefCSROrFI(const MachineInstr &MI, RegScavenger *RS) const { + /// Check if \p Op is known to access an address not on the function's stack . + /// At the moment, accesses where the underlying object is a global or a + /// function argument are considered non-stack accesses. Note that the + /// caller's stack may get accessed when passing an argument via the stack, + /// but not the stack of the current function. + /// + auto IsKnownNonStackPtr = [](MachineMemOperand *Op) { + if (Op->getValue()) { + SmallVector Objs; + const Value *UO = getUnderlyingObject(Op->getValue()); + return UO && (isa(UO) || isa(UO)); + } + return false; + }; // This prevents premature stack popping when occurs a indirect stack - // access. It is overly aggressive for the moment. - // TODO: - Obvious non-stack loads and store, such as global values, - // are known to not access the stack. + // access. It is overly aggressive for the moment. + // TODO: // - Further, data dependency and alias analysis can validate // that load and stores never derive from the stack pointer. - if (MI.mayLoadOrStore()) + if (MI.mayLoadOrStore() && (MI.isCall() || MI.hasUnmodeledSideEffects() || + !all_of(MI.memoperands(), IsKnownNonStackPtr))) return true; if (MI.getOpcode() == FrameSetupOpcode || diff --git a/llvm/test/CodeGen/AArch64/addsub.ll b/llvm/test/CodeGen/AArch64/addsub.ll --- a/llvm/test/CodeGen/AArch64/addsub.ll +++ b/llvm/test/CodeGen/AArch64/addsub.ll @@ -651,9 +651,6 @@ define dso_local i32 @_extract_crng_crng() { ; CHECK-LABEL: _extract_crng_crng: ; CHECK: // %bb.0: // %entry -; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill -; CHECK-NEXT: .cfi_def_cfa_offset 16 -; CHECK-NEXT: .cfi_offset w30, -16 ; CHECK-NEXT: adrp x8, _extract_crng_crng ; CHECK-NEXT: add x8, x8, :lo12:_extract_crng_crng ; CHECK-NEXT: tbnz x8, #63, .LBB36_2 @@ -665,6 +662,9 @@ ; CHECK-NEXT: cmn x8, #1272 ; CHECK-NEXT: b.pl .LBB36_3 ; CHECK-NEXT: .LBB36_2: // %if.then +; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill +; CHECK-NEXT: .cfi_def_cfa_offset 16 +; CHECK-NEXT: .cfi_offset w30, -16 ; CHECK-NEXT: adrp x8, primary_crng ; CHECK-NEXT: adrp x9, input_pool ; CHECK-NEXT: add x9, x9, :lo12:input_pool @@ -672,8 +672,10 @@ ; CHECK-NEXT: cmp w8, #0 ; CHECK-NEXT: csel x0, xzr, x9, eq ; CHECK-NEXT: bl crng_reseed -; CHECK-NEXT: .LBB36_3: // %if.end ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload +; CHECK-NEXT: .LBB36_3: // %if.end +; CHECK-NEXT: .cfi_def_cfa wsp, 0 +; CHECK-NEXT: .cfi_same_value w30 ; CHECK-NEXT: ret entry: br i1 icmp slt (ptr @_extract_crng_crng, ptr null), label %if.then, label %lor.lhs.false diff --git a/llvm/test/CodeGen/AArch64/arm64-shrink-wrapping.ll b/llvm/test/CodeGen/AArch64/arm64-shrink-wrapping.ll --- a/llvm/test/CodeGen/AArch64/arm64-shrink-wrapping.ll +++ b/llvm/test/CodeGen/AArch64/arm64-shrink-wrapping.ll @@ -1004,25 +1004,28 @@ define i32 @stack_realign(i32 %a, i32 %b, ptr %ptr1, ptr %ptr2) { ; ENABLE-LABEL: stack_realign: ; ENABLE: ; %bb.0: +; ENABLE-NEXT: lsl w8, w0, w1 +; ENABLE-NEXT: lsl w9, w1, w0 +; ENABLE-NEXT: cmp w0, w1 +; ENABLE-NEXT: b.ge LBB13_2 +; ENABLE-NEXT: ; %bb.1: ; %true ; ENABLE-NEXT: stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill ; ENABLE-NEXT: .cfi_def_cfa_offset 16 ; ENABLE-NEXT: mov x29, sp ; ENABLE-NEXT: .cfi_def_cfa w29, 16 ; ENABLE-NEXT: .cfi_offset w30, -8 ; ENABLE-NEXT: .cfi_offset w29, -16 -; ENABLE-NEXT: sub x9, sp, #16 -; ENABLE-NEXT: and sp, x9, #0xffffffffffffffe0 -; ENABLE-NEXT: lsl w8, w0, w1 -; ENABLE-NEXT: lsl w9, w1, w0 -; ENABLE-NEXT: cmp w0, w1 -; ENABLE-NEXT: b.ge LBB13_2 -; ENABLE-NEXT: ; %bb.1: ; %true +; ENABLE-NEXT: sub x1, sp, #16 +; ENABLE-NEXT: and sp, x1, #0xffffffffffffffe0 ; ENABLE-NEXT: str w0, [sp] +; ENABLE-NEXT: mov sp, x29 +; ENABLE-NEXT: ldp x29, x30, [sp], #16 ; 16-byte Folded Reload ; ENABLE-NEXT: LBB13_2: ; %false +; ENABLE-NEXT: .cfi_def_cfa wsp, 0 +; ENABLE-NEXT: .cfi_same_value w30 +; ENABLE-NEXT: .cfi_same_value w29 ; ENABLE-NEXT: str w8, [x2] ; ENABLE-NEXT: str w9, [x3] -; ENABLE-NEXT: mov sp, x29 -; ENABLE-NEXT: ldp x29, x30, [sp], #16 ; 16-byte Folded Reload ; ENABLE-NEXT: ret ; ; DISABLE-LABEL: stack_realign: diff --git a/llvm/test/CodeGen/AArch64/combine-comparisons-by-cse.ll b/llvm/test/CodeGen/AArch64/combine-comparisons-by-cse.ll --- a/llvm/test/CodeGen/AArch64/combine-comparisons-by-cse.ll +++ b/llvm/test/CodeGen/AArch64/combine-comparisons-by-cse.ll @@ -658,28 +658,28 @@ define i32 @fcmpri(i32 %argc, ptr nocapture readonly %argv) #0 { ; CHECK-LABEL: fcmpri: ; CHECK: // %bb.0: // %entry -; CHECK-NEXT: str d8, [sp, #-32]! // 8-byte Folded Spill -; CHECK-NEXT: .cfi_def_cfa_offset 32 -; CHECK-NEXT: stp x30, x19, [sp, #16] // 16-byte Folded Spill -; CHECK-NEXT: .cfi_offset w19, -8 -; CHECK-NEXT: .cfi_offset w30, -16 -; CHECK-NEXT: .cfi_offset b8, -32 ; CHECK-NEXT: cmp w0, #2 ; CHECK-NEXT: b.lt .LBB9_3 ; CHECK-NEXT: // %bb.1: // %land.lhs.true ; CHECK-NEXT: ldr x8, [x1, #8] ; CHECK-NEXT: cbz x8, .LBB9_3 ; CHECK-NEXT: // %bb.2: -; CHECK-NEXT: mov w0, #3 -; CHECK-NEXT: b .LBB9_4 +; CHECK-NEXT: mov w0, #3 // =0x3 +; CHECK-NEXT: ret ; CHECK-NEXT: .LBB9_3: // %if.end -; CHECK-NEXT: mov w0, #1 +; CHECK-NEXT: str d8, [sp, #-32]! // 8-byte Folded Spill +; CHECK-NEXT: .cfi_def_cfa_offset 32 +; CHECK-NEXT: stp x30, x19, [sp, #16] // 16-byte Folded Spill +; CHECK-NEXT: .cfi_offset w19, -8 +; CHECK-NEXT: .cfi_offset w30, -16 +; CHECK-NEXT: .cfi_offset b8, -32 +; CHECK-NEXT: mov w0, #1 // =0x1 ; CHECK-NEXT: bl zoo ; CHECK-NEXT: mov w19, w0 -; CHECK-NEXT: mov w0, #-1 +; CHECK-NEXT: mov w0, #-1 // =0xffffffff ; CHECK-NEXT: bl yoo ; CHECK-NEXT: cmp w19, #0 -; CHECK-NEXT: mov w1, #2 +; CHECK-NEXT: mov w1, #2 // =0x2 ; CHECK-NEXT: cinc w0, w19, gt ; CHECK-NEXT: fmov d8, d0 ; CHECK-NEXT: bl xoo @@ -689,9 +689,8 @@ ; CHECK-NEXT: fadd d0, d8, d0 ; CHECK-NEXT: fcsel d0, d8, d0, gt ; CHECK-NEXT: bl woo -; CHECK-NEXT: mov w0, #4 -; CHECK-NEXT: .LBB9_4: // %return ; CHECK-NEXT: ldp x30, x19, [sp, #16] // 16-byte Folded Reload +; CHECK-NEXT: mov w0, #4 // =0x4 ; CHECK-NEXT: ldr d8, [sp], #32 // 8-byte Folded Reload ; CHECK-NEXT: .cfi_def_cfa_offset 0 ; CHECK-NEXT: .cfi_restore w19 diff --git a/llvm/test/CodeGen/AArch64/csr-split.ll b/llvm/test/CodeGen/AArch64/csr-split.ll --- a/llvm/test/CodeGen/AArch64/csr-split.ll +++ b/llvm/test/CodeGen/AArch64/csr-split.ll @@ -9,23 +9,17 @@ define dso_local signext i32 @test1(ptr %b) local_unnamed_addr uwtable { ; CHECK-LABEL: test1: ; CHECK: // %bb.0: // %entry -; CHECK-NEXT: stp x30, x19, [sp, #-16]! // 16-byte Folded Spill -; CHECK-NEXT: .cfi_def_cfa_offset 16 -; CHECK-NEXT: .cfi_offset w19, -8 -; CHECK-NEXT: .cfi_offset w30, -16 -; CHECK-NEXT: .cfi_remember_state ; CHECK-NEXT: adrp x8, a ; CHECK-NEXT: ldrsw x8, [x8, :lo12:a] ; CHECK-NEXT: cmp x8, x0 ; CHECK-NEXT: b.eq .LBB0_2 ; CHECK-NEXT: // %bb.1: // %if.end -; CHECK-NEXT: ldp x30, x19, [sp], #16 // 16-byte Folded Reload -; CHECK-NEXT: .cfi_def_cfa_offset 0 -; CHECK-NEXT: .cfi_restore w19 -; CHECK-NEXT: .cfi_restore w30 ; CHECK-NEXT: ret ; CHECK-NEXT: .LBB0_2: // %if.then -; CHECK-NEXT: .cfi_restore_state +; CHECK-NEXT: stp x30, x19, [sp, #-16]! // 16-byte Folded Spill +; CHECK-NEXT: .cfi_def_cfa_offset 16 +; CHECK-NEXT: .cfi_offset w19, -8 +; CHECK-NEXT: .cfi_offset w30, -16 ; CHECK-NEXT: mov x19, x0 ; CHECK-NEXT: bl callVoid ; CHECK-NEXT: mov x0, x19 @@ -37,14 +31,6 @@ ; ; CHECK-APPLE-LABEL: test1: ; CHECK-APPLE: ; %bb.0: ; %entry -; CHECK-APPLE-NEXT: stp x20, x19, [sp, #-32]! ; 16-byte Folded Spill -; CHECK-APPLE-NEXT: .cfi_def_cfa_offset 32 -; CHECK-APPLE-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill -; CHECK-APPLE-NEXT: .cfi_offset w30, -8 -; CHECK-APPLE-NEXT: .cfi_offset w29, -16 -; CHECK-APPLE-NEXT: .cfi_offset w19, -24 -; CHECK-APPLE-NEXT: .cfi_offset w20, -32 -; CHECK-APPLE-NEXT: .cfi_remember_state ; CHECK-APPLE-NEXT: Lloh0: ; CHECK-APPLE-NEXT: adrp x8, _a@PAGE ; CHECK-APPLE-NEXT: Lloh1: @@ -52,16 +38,15 @@ ; CHECK-APPLE-NEXT: cmp x8, x0 ; CHECK-APPLE-NEXT: b.eq LBB0_2 ; CHECK-APPLE-NEXT: ; %bb.1: ; %if.end -; CHECK-APPLE-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload -; CHECK-APPLE-NEXT: ldp x20, x19, [sp], #32 ; 16-byte Folded Reload -; CHECK-APPLE-NEXT: .cfi_def_cfa_offset 0 -; CHECK-APPLE-NEXT: .cfi_restore w30 -; CHECK-APPLE-NEXT: .cfi_restore w29 -; CHECK-APPLE-NEXT: .cfi_restore w19 -; CHECK-APPLE-NEXT: .cfi_restore w20 ; CHECK-APPLE-NEXT: ret ; CHECK-APPLE-NEXT: LBB0_2: ; %if.then -; CHECK-APPLE-NEXT: .cfi_restore_state +; CHECK-APPLE-NEXT: stp x20, x19, [sp, #-32]! ; 16-byte Folded Spill +; CHECK-APPLE-NEXT: .cfi_def_cfa_offset 32 +; CHECK-APPLE-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill +; CHECK-APPLE-NEXT: .cfi_offset w30, -8 +; CHECK-APPLE-NEXT: .cfi_offset w29, -16 +; CHECK-APPLE-NEXT: .cfi_offset w19, -24 +; CHECK-APPLE-NEXT: .cfi_offset w20, -32 ; CHECK-APPLE-NEXT: mov x19, x0 ; CHECK-APPLE-NEXT: bl _callVoid ; CHECK-APPLE-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload diff --git a/llvm/test/CodeGen/AArch64/taildup-cfi.ll b/llvm/test/CodeGen/AArch64/taildup-cfi.ll --- a/llvm/test/CodeGen/AArch64/taildup-cfi.ll +++ b/llvm/test/CodeGen/AArch64/taildup-cfi.ll @@ -32,7 +32,7 @@ store i32 0, ptr @f, align 4, !tbaa !2 br label %if.end -; DARWIN: Merging into block +; DARWIN-NOT: Merging into block ; LINUX: Merging into block if.end: ; preds = %entry.if.end_crit_edge, %if.then diff --git a/llvm/test/CodeGen/X86/2010-08-04-MaskedSignedCompare.ll b/llvm/test/CodeGen/X86/2010-08-04-MaskedSignedCompare.ll --- a/llvm/test/CodeGen/X86/2010-08-04-MaskedSignedCompare.ll +++ b/llvm/test/CodeGen/X86/2010-08-04-MaskedSignedCompare.ll @@ -9,7 +9,6 @@ define dso_local i32 @main() nounwind { ; CHECK-LABEL: main: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: pushq %rax ; CHECK-NEXT: xorl %eax, %eax ; CHECK-NEXT: cmpq g_16(%rip), %rax ; CHECK-NEXT: sbbl %eax, %eax @@ -22,6 +21,7 @@ ; CHECK-NEXT: .LBB0_1: # %entry.if.end_crit_edge ; CHECK-NEXT: movl g_38(%rip), %esi ; CHECK-NEXT: .LBB0_3: # %if.end +; CHECK-NEXT: pushq %rax ; CHECK-NEXT: movl $.L.str, %edi ; CHECK-NEXT: xorl %eax, %eax ; CHECK-NEXT: callq printf@PLT diff --git a/llvm/test/CodeGen/X86/cmov.ll b/llvm/test/CodeGen/X86/cmov.ll --- a/llvm/test/CodeGen/X86/cmov.ll +++ b/llvm/test/CodeGen/X86/cmov.ll @@ -78,7 +78,6 @@ define i1 @test4() nounwind { ; CHECK-LABEL: test4: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: pushq %rbx ; CHECK-NEXT: movsbl g_3(%rip), %edx ; CHECK-NEXT: movzbl %dl, %ecx ; CHECK-NEXT: shrl $7, %ecx @@ -91,6 +90,7 @@ ; CHECK-NEXT: # %bb.1: # %bb.i.i.i ; CHECK-NEXT: movzbl g_100(%rip), %ecx ; CHECK-NEXT: .LBB3_2: # %func_4.exit.i +; CHECK-NEXT: pushq %rbx ; CHECK-NEXT: xorl %esi, %esi ; CHECK-NEXT: testb %dl, %dl ; CHECK-NEXT: setne %bl diff --git a/llvm/test/CodeGen/X86/copy-eflags.ll b/llvm/test/CodeGen/X86/copy-eflags.ll --- a/llvm/test/CodeGen/X86/copy-eflags.ll +++ b/llvm/test/CodeGen/X86/copy-eflags.ll @@ -43,7 +43,6 @@ ; ; X64-LABEL: test1: ; X64: # %bb.0: # %entry -; X64-NEXT: pushq %rax ; X64-NEXT: movzbl b(%rip), %ecx ; X64-NEXT: leal 1(%rcx), %eax ; X64-NEXT: movb %al, b(%rip) @@ -57,11 +56,12 @@ ; X64-NEXT: testb %dl, %dl ; X64-NEXT: jne .LBB0_2 ; X64-NEXT: # %bb.1: # %if.then +; X64-NEXT: pushq %rax ; X64-NEXT: movsbl %al, %edi ; X64-NEXT: callq external +; X64-NEXT: addq $8, %rsp ; X64-NEXT: .LBB0_2: # %if.end ; X64-NEXT: xorl %eax, %eax -; X64-NEXT: popq %rcx ; X64-NEXT: retq entry: %bval = load i8, ptr @b diff --git a/llvm/test/CodeGen/X86/csr-split.ll b/llvm/test/CodeGen/X86/csr-split.ll --- a/llvm/test/CodeGen/X86/csr-split.ll +++ b/llvm/test/CodeGen/X86/csr-split.ll @@ -9,18 +9,15 @@ define dso_local signext i32 @test1(ptr %b) local_unnamed_addr { ; CHECK-LABEL: test1: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: pushq %rbx -; CHECK-NEXT: .cfi_def_cfa_offset 16 -; CHECK-NEXT: .cfi_offset %rbx, -16 ; CHECK-NEXT: movslq a(%rip), %rax ; CHECK-NEXT: cmpq %rdi, %rax ; CHECK-NEXT: je .LBB0_2 ; CHECK-NEXT: # %bb.1: # %if.end -; CHECK-NEXT: popq %rbx -; CHECK-NEXT: .cfi_def_cfa_offset 8 ; CHECK-NEXT: retq ; CHECK-NEXT: .LBB0_2: # %if.then +; CHECK-NEXT: pushq %rbx ; CHECK-NEXT: .cfi_def_cfa_offset 16 +; CHECK-NEXT: .cfi_offset %rbx, -16 ; CHECK-NEXT: movq %rdi, %rbx ; CHECK-NEXT: callq callVoid@PLT ; CHECK-NEXT: movq %rbx, %rdi diff --git a/llvm/test/CodeGen/X86/i686-win-shrink-wrapping.ll b/llvm/test/CodeGen/X86/i686-win-shrink-wrapping.ll --- a/llvm/test/CodeGen/X86/i686-win-shrink-wrapping.ll +++ b/llvm/test/CodeGen/X86/i686-win-shrink-wrapping.ll @@ -11,10 +11,6 @@ define x86_thiscallcc void @stackRealignment(ptr %this) { ; SHRINK-WRAP-LABEL: stackRealignment: ; SHRINK-WRAP: # %bb.0: # %entry -; SHRINK-WRAP-NEXT: pushl %ebp -; SHRINK-WRAP-NEXT: movl %esp, %ebp -; SHRINK-WRAP-NEXT: andl $-8, %esp -; SHRINK-WRAP-NEXT: subl $16, %esp ; SHRINK-WRAP-NEXT: movl (%ecx), %eax ; SHRINK-WRAP-NEXT: cmpl $33, %eax ; SHRINK-WRAP-NEXT: movl $42, %edx @@ -22,6 +18,10 @@ ; SHRINK-WRAP-NEXT: # %bb.1: # %entry ; SHRINK-WRAP-NEXT: movl $128, %edx ; SHRINK-WRAP-NEXT: LBB0_2: # %entry +; SHRINK-WRAP-NEXT: pushl %ebp +; SHRINK-WRAP-NEXT: movl %esp, %ebp +; SHRINK-WRAP-NEXT: andl $-8, %esp +; SHRINK-WRAP-NEXT: subl $16, %esp ; SHRINK-WRAP-NEXT: movl %edx, {{[0-9]+}}(%esp) ; SHRINK-WRAP-NEXT: cmpl $32, %eax ; SHRINK-WRAP-NEXT: jl LBB0_4 diff --git a/llvm/test/CodeGen/X86/inline-asm-flag-output.ll b/llvm/test/CodeGen/X86/inline-asm-flag-output.ll --- a/llvm/test/CodeGen/X86/inline-asm-flag-output.ll +++ b/llvm/test/CodeGen/X86/inline-asm-flag-output.ll @@ -888,15 +888,15 @@ ; ; X64-LABEL: test_cca_branch: ; X64: # %bb.0: # %entry -; X64-NEXT: pushq %rax ; X64-NEXT: #APP ; X64-NEXT: cmp %rdi,(%rsi) ; X64-NEXT: #NO_APP ; X64-NEXT: jbe .LBB28_2 ; X64-NEXT: # %bb.1: # %then +; X64-NEXT: pushq %rax ; X64-NEXT: callq bar@PLT +; X64-NEXT: addq $8, %rsp ; X64-NEXT: .LBB28_2: # %exit -; X64-NEXT: popq %rax ; X64-NEXT: retq entry: %cc = tail call i8 asm "cmp $2,$1", "={@cca},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr) nounwind @@ -928,15 +928,15 @@ ; ; X64-LABEL: test_ccae_branch: ; X64: # %bb.0: # %entry -; X64-NEXT: pushq %rax ; X64-NEXT: #APP ; X64-NEXT: cmp %rdi,(%rsi) ; X64-NEXT: #NO_APP ; X64-NEXT: jb .LBB29_2 ; X64-NEXT: # %bb.1: # %then +; X64-NEXT: pushq %rax ; X64-NEXT: callq bar@PLT +; X64-NEXT: addq $8, %rsp ; X64-NEXT: .LBB29_2: # %exit -; X64-NEXT: popq %rax ; X64-NEXT: retq entry: %cc = tail call i8 asm "cmp $2,$1", "={@ccae},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr) nounwind @@ -968,15 +968,15 @@ ; ; X64-LABEL: test_ccb_branch: ; X64: # %bb.0: # %entry -; X64-NEXT: pushq %rax ; X64-NEXT: #APP ; X64-NEXT: cmp %rdi,(%rsi) ; X64-NEXT: #NO_APP ; X64-NEXT: jae .LBB30_2 ; X64-NEXT: # %bb.1: # %then +; X64-NEXT: pushq %rax ; X64-NEXT: callq bar@PLT +; X64-NEXT: addq $8, %rsp ; X64-NEXT: .LBB30_2: # %exit -; X64-NEXT: popq %rax ; X64-NEXT: retq entry: %cc = tail call i8 asm "cmp $2,$1", "={@ccb},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr) nounwind @@ -1008,15 +1008,15 @@ ; ; X64-LABEL: test_ccbe_branch: ; X64: # %bb.0: # %entry -; X64-NEXT: pushq %rax ; X64-NEXT: #APP ; X64-NEXT: cmp %rdi,(%rsi) ; X64-NEXT: #NO_APP ; X64-NEXT: ja .LBB31_2 ; X64-NEXT: # %bb.1: # %then +; X64-NEXT: pushq %rax ; X64-NEXT: callq bar@PLT +; X64-NEXT: addq $8, %rsp ; X64-NEXT: .LBB31_2: # %exit -; X64-NEXT: popq %rax ; X64-NEXT: retq entry: %cc = tail call i8 asm "cmp $2,$1", "={@ccbe},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr) nounwind @@ -1048,15 +1048,15 @@ ; ; X64-LABEL: test_ccc_branch: ; X64: # %bb.0: # %entry -; X64-NEXT: pushq %rax ; X64-NEXT: #APP ; X64-NEXT: cmp %rdi,(%rsi) ; X64-NEXT: #NO_APP ; X64-NEXT: jae .LBB32_2 ; X64-NEXT: # %bb.1: # %then +; X64-NEXT: pushq %rax ; X64-NEXT: callq bar@PLT +; X64-NEXT: addq $8, %rsp ; X64-NEXT: .LBB32_2: # %exit -; X64-NEXT: popq %rax ; X64-NEXT: retq entry: %cc = tail call i8 asm "cmp $2,$1", "={@ccc},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr) nounwind @@ -1088,15 +1088,15 @@ ; ; X64-LABEL: test_cce_branch: ; X64: # %bb.0: # %entry -; X64-NEXT: pushq %rax ; X64-NEXT: #APP ; X64-NEXT: cmp %rdi,(%rsi) ; X64-NEXT: #NO_APP ; X64-NEXT: jne .LBB33_2 ; X64-NEXT: # %bb.1: # %then +; X64-NEXT: pushq %rax ; X64-NEXT: callq bar@PLT +; X64-NEXT: addq $8, %rsp ; X64-NEXT: .LBB33_2: # %exit -; X64-NEXT: popq %rax ; X64-NEXT: retq entry: %cc = tail call i8 asm "cmp $2,$1", "={@cce},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr) nounwind @@ -1128,15 +1128,15 @@ ; ; X64-LABEL: test_ccz_branch: ; X64: # %bb.0: # %entry -; X64-NEXT: pushq %rax ; X64-NEXT: #APP ; X64-NEXT: cmp %rdi,(%rsi) ; X64-NEXT: #NO_APP ; X64-NEXT: jne .LBB34_2 ; X64-NEXT: # %bb.1: # %then +; X64-NEXT: pushq %rax ; X64-NEXT: callq bar@PLT +; X64-NEXT: addq $8, %rsp ; X64-NEXT: .LBB34_2: # %exit -; X64-NEXT: popq %rax ; X64-NEXT: retq entry: %cc = tail call i8 asm "cmp $2,$1", "={@ccz},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr) nounwind @@ -1168,15 +1168,15 @@ ; ; X64-LABEL: test_ccg_branch: ; X64: # %bb.0: # %entry -; X64-NEXT: pushq %rax ; X64-NEXT: #APP ; X64-NEXT: cmp %rdi,(%rsi) ; X64-NEXT: #NO_APP ; X64-NEXT: jle .LBB35_2 ; X64-NEXT: # %bb.1: # %then +; X64-NEXT: pushq %rax ; X64-NEXT: callq bar@PLT +; X64-NEXT: addq $8, %rsp ; X64-NEXT: .LBB35_2: # %exit -; X64-NEXT: popq %rax ; X64-NEXT: retq entry: %cc = tail call i8 asm "cmp $2,$1", "={@ccg},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr) nounwind @@ -1208,15 +1208,15 @@ ; ; X64-LABEL: test_ccge_branch: ; X64: # %bb.0: # %entry -; X64-NEXT: pushq %rax ; X64-NEXT: #APP ; X64-NEXT: cmp %rdi,(%rsi) ; X64-NEXT: #NO_APP ; X64-NEXT: jl .LBB36_2 ; X64-NEXT: # %bb.1: # %then +; X64-NEXT: pushq %rax ; X64-NEXT: callq bar@PLT +; X64-NEXT: addq $8, %rsp ; X64-NEXT: .LBB36_2: # %exit -; X64-NEXT: popq %rax ; X64-NEXT: retq entry: %cc = tail call i8 asm "cmp $2,$1", "={@ccge},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr) nounwind @@ -1248,15 +1248,15 @@ ; ; X64-LABEL: test_ccl_branch: ; X64: # %bb.0: # %entry -; X64-NEXT: pushq %rax ; X64-NEXT: #APP ; X64-NEXT: cmp %rdi,(%rsi) ; X64-NEXT: #NO_APP ; X64-NEXT: jge .LBB37_2 ; X64-NEXT: # %bb.1: # %then +; X64-NEXT: pushq %rax ; X64-NEXT: callq bar@PLT +; X64-NEXT: addq $8, %rsp ; X64-NEXT: .LBB37_2: # %exit -; X64-NEXT: popq %rax ; X64-NEXT: retq entry: %cc = tail call i8 asm "cmp $2,$1", "={@ccl},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr) nounwind @@ -1288,15 +1288,15 @@ ; ; X64-LABEL: test_ccle_branch: ; X64: # %bb.0: # %entry -; X64-NEXT: pushq %rax ; X64-NEXT: #APP ; X64-NEXT: cmp %rdi,(%rsi) ; X64-NEXT: #NO_APP ; X64-NEXT: jg .LBB38_2 ; X64-NEXT: # %bb.1: # %then +; X64-NEXT: pushq %rax ; X64-NEXT: callq bar@PLT +; X64-NEXT: addq $8, %rsp ; X64-NEXT: .LBB38_2: # %exit -; X64-NEXT: popq %rax ; X64-NEXT: retq entry: %cc = tail call i8 asm "cmp $2,$1", "={@ccle},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr) nounwind @@ -1328,15 +1328,15 @@ ; ; X64-LABEL: test_ccna_branch: ; X64: # %bb.0: # %entry -; X64-NEXT: pushq %rax ; X64-NEXT: #APP ; X64-NEXT: cmp %rdi,(%rsi) ; X64-NEXT: #NO_APP ; X64-NEXT: ja .LBB39_2 ; X64-NEXT: # %bb.1: # %then +; X64-NEXT: pushq %rax ; X64-NEXT: callq bar@PLT +; X64-NEXT: addq $8, %rsp ; X64-NEXT: .LBB39_2: # %exit -; X64-NEXT: popq %rax ; X64-NEXT: retq entry: %cc = tail call i8 asm "cmp $2,$1", "={@ccna},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr) nounwind @@ -1368,15 +1368,15 @@ ; ; X64-LABEL: test_ccnae_branch: ; X64: # %bb.0: # %entry -; X64-NEXT: pushq %rax ; X64-NEXT: #APP ; X64-NEXT: cmp %rdi,(%rsi) ; X64-NEXT: #NO_APP ; X64-NEXT: jae .LBB40_2 ; X64-NEXT: # %bb.1: # %then +; X64-NEXT: pushq %rax ; X64-NEXT: callq bar@PLT +; X64-NEXT: addq $8, %rsp ; X64-NEXT: .LBB40_2: # %exit -; X64-NEXT: popq %rax ; X64-NEXT: retq entry: %cc = tail call i8 asm "cmp $2,$1", "={@ccnae},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr) nounwind @@ -1408,15 +1408,15 @@ ; ; X64-LABEL: test_ccnb_branch: ; X64: # %bb.0: # %entry -; X64-NEXT: pushq %rax ; X64-NEXT: #APP ; X64-NEXT: cmp %rdi,(%rsi) ; X64-NEXT: #NO_APP ; X64-NEXT: jb .LBB41_2 ; X64-NEXT: # %bb.1: # %then +; X64-NEXT: pushq %rax ; X64-NEXT: callq bar@PLT +; X64-NEXT: addq $8, %rsp ; X64-NEXT: .LBB41_2: # %exit -; X64-NEXT: popq %rax ; X64-NEXT: retq entry: %cc = tail call i8 asm "cmp $2,$1", "={@ccnb},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr) nounwind @@ -1448,15 +1448,15 @@ ; ; X64-LABEL: test_ccnbe_branch: ; X64: # %bb.0: # %entry -; X64-NEXT: pushq %rax ; X64-NEXT: #APP ; X64-NEXT: cmp %rdi,(%rsi) ; X64-NEXT: #NO_APP ; X64-NEXT: jbe .LBB42_2 ; X64-NEXT: # %bb.1: # %then +; X64-NEXT: pushq %rax ; X64-NEXT: callq bar@PLT +; X64-NEXT: addq $8, %rsp ; X64-NEXT: .LBB42_2: # %exit -; X64-NEXT: popq %rax ; X64-NEXT: retq entry: %cc = tail call i8 asm "cmp $2,$1", "={@ccnbe},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr) nounwind @@ -1488,15 +1488,15 @@ ; ; X64-LABEL: test_ccnc_branch: ; X64: # %bb.0: # %entry -; X64-NEXT: pushq %rax ; X64-NEXT: #APP ; X64-NEXT: cmp %rdi,(%rsi) ; X64-NEXT: #NO_APP ; X64-NEXT: jb .LBB43_2 ; X64-NEXT: # %bb.1: # %then +; X64-NEXT: pushq %rax ; X64-NEXT: callq bar@PLT +; X64-NEXT: addq $8, %rsp ; X64-NEXT: .LBB43_2: # %exit -; X64-NEXT: popq %rax ; X64-NEXT: retq entry: %cc = tail call i8 asm "cmp $2,$1", "={@ccnc},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr) nounwind @@ -1528,15 +1528,15 @@ ; ; X64-LABEL: test_ccne_branch: ; X64: # %bb.0: # %entry -; X64-NEXT: pushq %rax ; X64-NEXT: #APP ; X64-NEXT: cmp %rdi,(%rsi) ; X64-NEXT: #NO_APP ; X64-NEXT: je .LBB44_2 ; X64-NEXT: # %bb.1: # %then +; X64-NEXT: pushq %rax ; X64-NEXT: callq bar@PLT +; X64-NEXT: addq $8, %rsp ; X64-NEXT: .LBB44_2: # %exit -; X64-NEXT: popq %rax ; X64-NEXT: retq entry: %cc = tail call i8 asm "cmp $2,$1", "={@ccne},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr) nounwind @@ -1568,15 +1568,15 @@ ; ; X64-LABEL: test_ccnz_branch: ; X64: # %bb.0: # %entry -; X64-NEXT: pushq %rax ; X64-NEXT: #APP ; X64-NEXT: cmp %rdi,(%rsi) ; X64-NEXT: #NO_APP ; X64-NEXT: je .LBB45_2 ; X64-NEXT: # %bb.1: # %then +; X64-NEXT: pushq %rax ; X64-NEXT: callq bar@PLT +; X64-NEXT: addq $8, %rsp ; X64-NEXT: .LBB45_2: # %exit -; X64-NEXT: popq %rax ; X64-NEXT: retq entry: %cc = tail call i8 asm "cmp $2,$1", "={@ccnz},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr) nounwind @@ -1608,15 +1608,15 @@ ; ; X64-LABEL: test_ccng_branch: ; X64: # %bb.0: # %entry -; X64-NEXT: pushq %rax ; X64-NEXT: #APP ; X64-NEXT: cmp %rdi,(%rsi) ; X64-NEXT: #NO_APP ; X64-NEXT: jg .LBB46_2 ; X64-NEXT: # %bb.1: # %then +; X64-NEXT: pushq %rax ; X64-NEXT: callq bar@PLT +; X64-NEXT: addq $8, %rsp ; X64-NEXT: .LBB46_2: # %exit -; X64-NEXT: popq %rax ; X64-NEXT: retq entry: %cc = tail call i8 asm "cmp $2,$1", "={@ccng},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr) nounwind @@ -1648,15 +1648,15 @@ ; ; X64-LABEL: test_ccnge_branch: ; X64: # %bb.0: # %entry -; X64-NEXT: pushq %rax ; X64-NEXT: #APP ; X64-NEXT: cmp %rdi,(%rsi) ; X64-NEXT: #NO_APP ; X64-NEXT: jge .LBB47_2 ; X64-NEXT: # %bb.1: # %then +; X64-NEXT: pushq %rax ; X64-NEXT: callq bar@PLT +; X64-NEXT: addq $8, %rsp ; X64-NEXT: .LBB47_2: # %exit -; X64-NEXT: popq %rax ; X64-NEXT: retq entry: %cc = tail call i8 asm "cmp $2,$1", "={@ccnge},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr) nounwind @@ -1688,15 +1688,15 @@ ; ; X64-LABEL: test_ccnl_branch: ; X64: # %bb.0: # %entry -; X64-NEXT: pushq %rax ; X64-NEXT: #APP ; X64-NEXT: cmp %rdi,(%rsi) ; X64-NEXT: #NO_APP ; X64-NEXT: jl .LBB48_2 ; X64-NEXT: # %bb.1: # %then +; X64-NEXT: pushq %rax ; X64-NEXT: callq bar@PLT +; X64-NEXT: addq $8, %rsp ; X64-NEXT: .LBB48_2: # %exit -; X64-NEXT: popq %rax ; X64-NEXT: retq entry: %cc = tail call i8 asm "cmp $2,$1", "={@ccnl},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr) nounwind @@ -1728,15 +1728,15 @@ ; ; X64-LABEL: test_ccnle_branch: ; X64: # %bb.0: # %entry -; X64-NEXT: pushq %rax ; X64-NEXT: #APP ; X64-NEXT: cmp %rdi,(%rsi) ; X64-NEXT: #NO_APP ; X64-NEXT: jle .LBB49_2 ; X64-NEXT: # %bb.1: # %then +; X64-NEXT: pushq %rax ; X64-NEXT: callq bar@PLT +; X64-NEXT: addq $8, %rsp ; X64-NEXT: .LBB49_2: # %exit -; X64-NEXT: popq %rax ; X64-NEXT: retq entry: %cc = tail call i8 asm "cmp $2,$1", "={@ccnle},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr) nounwind @@ -1768,15 +1768,15 @@ ; ; X64-LABEL: test_ccno_branch: ; X64: # %bb.0: # %entry -; X64-NEXT: pushq %rax ; X64-NEXT: #APP ; X64-NEXT: cmp %rdi,(%rsi) ; X64-NEXT: #NO_APP ; X64-NEXT: jo .LBB50_2 ; X64-NEXT: # %bb.1: # %then +; X64-NEXT: pushq %rax ; X64-NEXT: callq bar@PLT +; X64-NEXT: addq $8, %rsp ; X64-NEXT: .LBB50_2: # %exit -; X64-NEXT: popq %rax ; X64-NEXT: retq entry: %cc = tail call i8 asm "cmp $2,$1", "={@ccno},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr) nounwind @@ -1808,15 +1808,15 @@ ; ; X64-LABEL: test_ccnp_branch: ; X64: # %bb.0: # %entry -; X64-NEXT: pushq %rax ; X64-NEXT: #APP ; X64-NEXT: cmp %rdi,(%rsi) ; X64-NEXT: #NO_APP ; X64-NEXT: jp .LBB51_2 ; X64-NEXT: # %bb.1: # %then +; X64-NEXT: pushq %rax ; X64-NEXT: callq bar@PLT +; X64-NEXT: addq $8, %rsp ; X64-NEXT: .LBB51_2: # %exit -; X64-NEXT: popq %rax ; X64-NEXT: retq entry: %cc = tail call i8 asm "cmp $2,$1", "={@ccnp},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr) nounwind @@ -1848,15 +1848,15 @@ ; ; X64-LABEL: test_ccns_branch: ; X64: # %bb.0: # %entry -; X64-NEXT: pushq %rax ; X64-NEXT: #APP ; X64-NEXT: cmp %rdi,(%rsi) ; X64-NEXT: #NO_APP ; X64-NEXT: js .LBB52_2 ; X64-NEXT: # %bb.1: # %then +; X64-NEXT: pushq %rax ; X64-NEXT: callq bar@PLT +; X64-NEXT: addq $8, %rsp ; X64-NEXT: .LBB52_2: # %exit -; X64-NEXT: popq %rax ; X64-NEXT: retq entry: %cc = tail call i8 asm "cmp $2,$1", "={@ccns},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr) nounwind @@ -1888,15 +1888,15 @@ ; ; X64-LABEL: test_cco_branch: ; X64: # %bb.0: # %entry -; X64-NEXT: pushq %rax ; X64-NEXT: #APP ; X64-NEXT: cmp %rdi,(%rsi) ; X64-NEXT: #NO_APP ; X64-NEXT: jno .LBB53_2 ; X64-NEXT: # %bb.1: # %then +; X64-NEXT: pushq %rax ; X64-NEXT: callq bar@PLT +; X64-NEXT: addq $8, %rsp ; X64-NEXT: .LBB53_2: # %exit -; X64-NEXT: popq %rax ; X64-NEXT: retq entry: %cc = tail call i8 asm "cmp $2,$1", "={@cco},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr) nounwind @@ -1928,15 +1928,15 @@ ; ; X64-LABEL: test_ccp_branch: ; X64: # %bb.0: # %entry -; X64-NEXT: pushq %rax ; X64-NEXT: #APP ; X64-NEXT: cmp %rdi,(%rsi) ; X64-NEXT: #NO_APP ; X64-NEXT: jnp .LBB54_2 ; X64-NEXT: # %bb.1: # %then +; X64-NEXT: pushq %rax ; X64-NEXT: callq bar@PLT +; X64-NEXT: addq $8, %rsp ; X64-NEXT: .LBB54_2: # %exit -; X64-NEXT: popq %rax ; X64-NEXT: retq entry: %cc = tail call i8 asm "cmp $2,$1", "={@ccp},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr) nounwind @@ -1968,15 +1968,15 @@ ; ; X64-LABEL: test_ccs_branch: ; X64: # %bb.0: # %entry -; X64-NEXT: pushq %rax ; X64-NEXT: #APP ; X64-NEXT: cmp %rdi,(%rsi) ; X64-NEXT: #NO_APP ; X64-NEXT: jns .LBB55_2 ; X64-NEXT: # %bb.1: # %then +; X64-NEXT: pushq %rax ; X64-NEXT: callq bar@PLT +; X64-NEXT: addq $8, %rsp ; X64-NEXT: .LBB55_2: # %exit -; X64-NEXT: popq %rax ; X64-NEXT: retq entry: %cc = tail call i8 asm "cmp $2,$1", "={@ccs},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr) nounwind diff --git a/llvm/test/CodeGen/X86/peep-test-5.ll b/llvm/test/CodeGen/X86/peep-test-5.ll --- a/llvm/test/CodeGen/X86/peep-test-5.ll +++ b/llvm/test/CodeGen/X86/peep-test-5.ll @@ -12,25 +12,22 @@ define void @decref(ptr %p) { ; CHECK-LABEL: decref: ; CHECK: # %bb.0: -; CHECK-NEXT: pushq %rax -; CHECK-NEXT: .cfi_def_cfa_offset 16 ; CHECK-NEXT: movl (%rdi), %eax ; CHECK-NEXT: cmpl $1, %eax ; CHECK-NEXT: jne .LBB0_2 ; CHECK-NEXT: # %bb.1: # %bb_free +; CHECK-NEXT: pushq %rax +; CHECK-NEXT: .cfi_def_cfa_offset 16 ; CHECK-NEXT: callq free_object@PLT -; CHECK-NEXT: .LBB0_4: # %end -; CHECK-NEXT: popq %rax +; CHECK-NEXT: addq $8, %rsp ; CHECK-NEXT: .cfi_def_cfa_offset 8 +; CHECK-NEXT: .LBB0_4: # %end ; CHECK-NEXT: retq ; CHECK-NEXT: .LBB0_2: # %bb2 -; CHECK-NEXT: .cfi_def_cfa_offset 16 ; CHECK-NEXT: jle .LBB0_4 ; CHECK-NEXT: # %bb.3: # %bb_dec ; CHECK-NEXT: decl %eax ; CHECK-NEXT: movl %eax, (%rdi) -; CHECK-NEXT: popq %rax -; CHECK-NEXT: .cfi_def_cfa_offset 8 ; CHECK-NEXT: retq %count = load i32, ptr %p, align 4 %cmp0 = icmp eq i32 %count, 1 diff --git a/llvm/test/CodeGen/X86/shrink-wrap-chkstk-x86_64.ll b/llvm/test/CodeGen/X86/shrink-wrap-chkstk-x86_64.ll --- a/llvm/test/CodeGen/X86/shrink-wrap-chkstk-x86_64.ll +++ b/llvm/test/CodeGen/X86/shrink-wrap-chkstk-x86_64.ll @@ -9,10 +9,6 @@ define void @fn1() nounwind uwtable { ; CHECK-LABEL: fn1: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: movl $4136, %eax # imm = 0x1028 -; CHECK-NEXT: callq ___chkstk_ms -; CHECK-NEXT: subq %rax, %rsp -; CHECK-NEXT: .cfi_def_cfa_offset 4144 ; CHECK-NEXT: movl a(%rip), %eax ; CHECK-NEXT: testl %eax, %eax ; CHECK-NEXT: jne .LBB0_2 @@ -24,6 +20,12 @@ ; CHECK-NEXT: shrq $32, %rax ; CHECK-NEXT: addl %ecx, %eax ; CHECK-NEXT: .LBB0_2: # %select.end +; CHECK-NEXT: pushq %rax +; CHECK-NEXT: movl $4128, %eax # imm = 0x1020 +; CHECK-NEXT: callq ___chkstk_ms +; CHECK-NEXT: subq %rax, %rsp +; CHECK-NEXT: movq {{[0-9]+}}(%rsp), %rax +; CHECK-NEXT: .cfi_def_cfa_offset 4144 ; CHECK-NEXT: movl %eax, b(%rip) ; CHECK-NEXT: leaq {{[0-9]+}}(%rsp), %rcx ; CHECK-NEXT: # kill: def $ecx killed $ecx killed $rcx diff --git a/llvm/test/CodeGen/X86/statepoint-vector.ll b/llvm/test/CodeGen/X86/statepoint-vector.ll --- a/llvm/test/CodeGen/X86/statepoint-vector.ll +++ b/llvm/test/CodeGen/X86/statepoint-vector.ll @@ -57,10 +57,10 @@ define <2 x ptr addrspace(1)> @test3(i1 %cnd, ptr %ptr) gc "statepoint-example" { ; CHECK-LABEL: test3: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: subq $40, %rsp -; CHECK-NEXT: .cfi_def_cfa_offset 48 ; CHECK-NEXT: testb $1, %dil ; CHECK-NEXT: movaps (%rsi), %xmm0 +; CHECK-NEXT: subq $40, %rsp +; CHECK-NEXT: .cfi_def_cfa_offset 48 ; CHECK-NEXT: movaps %xmm0, (%rsp) ; CHECK-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp) ; CHECK-NEXT: callq do_safepoint@PLT