• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -o - %s -mtriple=x86_64-linux-gnu | FileCheck %s --check-prefixes=CHECK,NORMAL
2; RUN: llc -o - %s -mtriple=x86_64-windows-msvc | FileCheck %s --check-prefixes=CHECK,NORMAL
3; RUN: llc -o - %s -mtriple=x86_64-scei-ps4 | FileCheck %s --check-prefixes=CHECK,TRAP_AFTER_NORETURN
4; RUN: llc -o - %s -mtriple=x86_64-apple-darwin | FileCheck %s --check-prefixes=CHECK,NO_TRAP_AFTER_NORETURN
5
6; CHECK-LABEL: call_exit:
7; CHECK: callq {{_?}}exit
8; TRAP_AFTER_NORETURN: ud2
9; NO_TRAP_AFTER_NORETURN-NOT: ud2
10; NORMAL-NOT: ud2
11define i32 @call_exit() noreturn nounwind {
12  tail call void @exit(i32 0)
13  unreachable
14}
15
16; CHECK-LABEL: trap:
17; CHECK: ud2
18; TRAP_AFTER_NORETURN: ud2
19; NO_TRAP_AFTER_NORETURN-NOT: ud2
20; NORMAL-NOT: ud2
21define i32 @trap() noreturn nounwind {
22  tail call void @llvm.trap()
23  unreachable
24}
25
26; CHECK-LABEL: unreachable:
27; TRAP_AFTER_NORETURN: ud2
28; NO_TRAP_AFTER_NORETURN: ud2
29; NORMAL-NOT: ud2
30; NORMAL: # -- End function
31define i32 @unreachable() noreturn nounwind {
32  unreachable
33}
34
35declare void @llvm.trap() nounwind noreturn
36declare void @exit(i32 %rc) nounwind noreturn
37