xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGen/unreachable.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
2*f4a2713aSLionel Sambuc // CHECK-NOT: @unreachable
3*f4a2713aSLionel Sambuc 
4*f4a2713aSLionel Sambuc extern void abort() __attribute__((noreturn));
5*f4a2713aSLionel Sambuc extern int unreachable();
6*f4a2713aSLionel Sambuc 
f0()7*f4a2713aSLionel Sambuc int f0() {
8*f4a2713aSLionel Sambuc   return 0;
9*f4a2713aSLionel Sambuc   unreachable();
10*f4a2713aSLionel Sambuc }
11*f4a2713aSLionel Sambuc 
f1(int i)12*f4a2713aSLionel Sambuc int f1(int i) {
13*f4a2713aSLionel Sambuc   goto L0;
14*f4a2713aSLionel Sambuc   int a = unreachable();
15*f4a2713aSLionel Sambuc  L0:
16*f4a2713aSLionel Sambuc   return 0;
17*f4a2713aSLionel Sambuc }
18*f4a2713aSLionel Sambuc 
f2(int i)19*f4a2713aSLionel Sambuc int f2(int i) {
20*f4a2713aSLionel Sambuc   goto L0;
21*f4a2713aSLionel Sambuc   unreachable();
22*f4a2713aSLionel Sambuc   int a;
23*f4a2713aSLionel Sambuc   unreachable();
24*f4a2713aSLionel Sambuc  L0:
25*f4a2713aSLionel Sambuc   a = i + 1;
26*f4a2713aSLionel Sambuc   return a;
27*f4a2713aSLionel Sambuc }
28*f4a2713aSLionel Sambuc 
f3(int i)29*f4a2713aSLionel Sambuc int f3(int i) {
30*f4a2713aSLionel Sambuc   if (i) {
31*f4a2713aSLionel Sambuc     return 0;
32*f4a2713aSLionel Sambuc   } else {
33*f4a2713aSLionel Sambuc     abort();
34*f4a2713aSLionel Sambuc   }
35*f4a2713aSLionel Sambuc   unreachable();
36*f4a2713aSLionel Sambuc   return 3;
37*f4a2713aSLionel Sambuc }
38