blob: 2671e82b6177d6ff4cce89a2f28b8580903cce08 [file] [log] [blame]
David Majnemer7a99dd42016-01-10 07:13:33 +00001; RUN: opt -prune-eh -inline -jump-threading -S < %s | FileCheck %s
2
3target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
4target triple = "x86_64-unknown-linux-gnu"
5
6@d = external global i32*, align 8
7
8define void @fn3(i1 %B) {
9entry:
10 br i1 %B, label %if.end, label %if.then
11
12if.then: ; preds = %entry
13 call void @fn2()
14 ret void
15
16if.end: ; preds = %entry
17 call void @fn2()
18 ret void
19}
20
21define internal void @fn2() unnamed_addr {
22entry:
23 call void @fn1()
24 call void @fn1()
25 call void @fn1()
26 unreachable
27}
28
29; CHECK-LABEL: define internal void @fn2(
30; CHECK: %[[LOAD:.*]] = load i32*, i32** @d, align 8
31; CHECK: %tobool1.i = icmp eq i32* %[[LOAD]], null
32
33define internal void @fn1() unnamed_addr {
34entry:
35 br label %for.body
36
37for.body: ; preds = %entry
38 %0 = load i32*, i32** @d, align 8
39 %tobool1 = icmp eq i32* %0, null
40 br i1 %tobool1, label %cond.false, label %cond.end
41
42cond.false: ; preds = %for.body
43 call void @__assert_fail(i8* null)
44 unreachable
45
46cond.end: ; preds = %for.body
47 %1 = load i32*, i32** @d, align 8
48 %cmp = icmp eq i32* %1, null
49 br i1 %cmp, label %cond.end4, label %cond.false3
50
51cond.false3: ; preds = %cond.end
52 call void @__assert_fail(i8* null)
53 unreachable
54
55cond.end4: ; preds = %cond.end
56 call void @__assert_fail(i8* null)
57 unreachable
58
59for.end: ; No predecessors!
60 ret void
61}
62
63declare void @__assert_fail(i8*)
64
65; Function Attrs: noreturn nounwind
66declare void @llvm.trap() #0
67
68attributes #0 = { noreturn nounwind }