diff options
Diffstat (limited to 'llvm/test')
-rw-r--r-- | llvm/test/CodeGen/X86/shadow-stack.ll | 2 | ||||
-rw-r--r-- | llvm/test/CodeGen/X86/unreachable-trap.ll | 29 |
2 files changed, 29 insertions, 2 deletions
diff --git a/llvm/test/CodeGen/X86/shadow-stack.ll b/llvm/test/CodeGen/X86/shadow-stack.ll index d0886f49c3e..6fa41378182 100644 --- a/llvm/test/CodeGen/X86/shadow-stack.ll +++ b/llvm/test/CodeGen/X86/shadow-stack.ll @@ -64,7 +64,6 @@ define i32 @bar(i32 %i) local_unnamed_addr { ; X86_64-NEXT: movq 8(%rax), %rcx ; X86_64-NEXT: movq 16(%rax), %rsp ; X86_64-NEXT: jmpq *%rcx -; X86_64-NEXT: ud2 ; ; X86-LABEL: bar: ; X86: ## %bb.0: ## %entry @@ -99,7 +98,6 @@ define i32 @bar(i32 %i) local_unnamed_addr { ; X86-NEXT: movl 4(%eax), %ecx ; X86-NEXT: movl 8(%eax), %esp ; X86-NEXT: jmpl *%ecx -; X86-NEXT: ud2 entry: %0 = load i8*, i8** @buf, align 8 tail call void @llvm.eh.sjlj.longjmp(i8* %0) diff --git a/llvm/test/CodeGen/X86/unreachable-trap.ll b/llvm/test/CodeGen/X86/unreachable-trap.ll new file mode 100644 index 00000000000..8de0510ed38 --- /dev/null +++ b/llvm/test/CodeGen/X86/unreachable-trap.ll @@ -0,0 +1,29 @@ +; RUN: llc -o - %s -mtriple=x86_64-windows-msvc | FileCheck %s --check-prefixes=CHECK,TRAP_AFTER_NORETURN +; RUN: llc -o - %s -mtriple=x86_64-apple-darwin | FileCheck %s --check-prefixes=CHECK,NO_TRAP_AFTER_NORETURN + +; CHECK-LABEL: call_exit: +; CHECK: callq {{_?}}exit +; TRAP_AFTER_NORETURN: ud2 +; NO_TRAP_AFTER_NORETURN-NOT: ud2 +define i32 @call_exit() noreturn nounwind { + tail call void @exit(i32 0) + unreachable +} + +; CHECK-LABEL: trap: +; CHECK: ud2 +; TRAP_AFTER_NORETURN: ud2 +; NO_TRAP_AFTER_NORETURN-NOT: ud2 +define i32 @trap() noreturn nounwind { + tail call void @llvm.trap() + unreachable +} + +; CHECK-LABEL: unreachable: +; CHECK: ud2 +define i32 @unreachable() noreturn nounwind { + unreachable +} + +declare void @llvm.trap() nounwind noreturn +declare void @exit(i32 %rc) nounwind noreturn |