diff options
| author | Martin Storsjo <martin@martin.st> | 2018-03-06 06:00:13 +0000 |
|---|---|---|
| committer | Martin Storsjo <martin@martin.st> | 2018-03-06 06:00:13 +0000 |
| commit | a7adc3185bef02576a39f0198b26f584cc8a184d (patch) | |
| tree | 5b6852653c6761aa02572310dbae994cb147eb42 /llvm/test | |
| parent | d43c0e1cb270e69878fc7142be976062897e7477 (diff) | |
| download | bcm5719-llvm-a7adc3185bef02576a39f0198b26f584cc8a184d.tar.gz bcm5719-llvm-a7adc3185bef02576a39f0198b26f584cc8a184d.zip | |
[X86] Handle EAX being live when calling chkstk for x86_64
EAX can turn out to be alive here, when shrink wrapping is done
(which is allowed when using dwarf exceptions, contrary to the
normal case with WinCFI).
This fixes PR36487.
Differential Revision: https://reviews.llvm.org/D43968
llvm-svn: 326764
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/CodeGen/X86/shrink-wrap-chkstk-x86_64.ll | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/shrink-wrap-chkstk-x86_64.ll b/llvm/test/CodeGen/X86/shrink-wrap-chkstk-x86_64.ll new file mode 100644 index 00000000000..b908200c5a6 --- /dev/null +++ b/llvm/test/CodeGen/X86/shrink-wrap-chkstk-x86_64.ll @@ -0,0 +1,36 @@ +; RUN: llc -mtriple=x86_64-windows-gnu -exception-model=dwarf < %s | FileCheck %s + +%struct.A = type { [4096 x i8] } + +@a = common global i32 0, align 4 +@b = common global i32 0, align 4 + +define void @fn1() nounwind uwtable { +entry: + %ctx = alloca %struct.A, align 1 + %0 = load i32, i32* @a, align 4 + %tobool = icmp eq i32 %0, 0 + %div = sdiv i32 %0, 6 + %cond = select i1 %tobool, i32 %div, i32 %0 + store i32 %cond, i32* @b, align 4 + %1 = getelementptr inbounds %struct.A, %struct.A* %ctx, i64 0, i32 0, i64 0 + call void @llvm.lifetime.start.p0i8(i64 4096, i8* nonnull %1) + %2 = ptrtoint %struct.A* %ctx to i64 + %3 = trunc i64 %2 to i32 + call void @fn2(i32 %3) + call void @llvm.lifetime.end.p0i8(i64 4096, i8* nonnull %1) + ret void +} + +declare void @fn2(i32) +declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) +declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) + +; CHECK-LABEL: fn1: +; CHECK: pushq %rax +; CHECK: movl $4128, %eax +; CHECK: callq ___chkstk_ms +; CHECK: subq %rax, %rsp +; CHECK: movq 4128(%rsp), %rax + +; CHECK: addq $4136, %rsp |

