• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; 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(i1 %B)
14  ret void
15
16if.end:                                           ; preds = %entry
17  call void @fn2(i1 %B)
18  ret void
19}
20
21define internal void @fn2(i1 %B) unnamed_addr {
22entry:
23  call void @fn1()
24  call void @fn1()
25  call void @fn1()
26  br i1 %B, label %if.end, label %if.then
27if.then:
28  unreachable
29
30if.end:
31  unreachable
32}
33
34; CHECK-LABEL: define internal void @fn2(
35; CHECK:   %[[LOAD:.*]] = load i32*, i32** @d, align 8
36; CHECK:   %tobool1.i = icmp eq i32* %[[LOAD]], null
37
38define internal void @fn1() unnamed_addr {
39entry:
40  br label %for.body
41
42for.body:                                         ; preds = %entry
43  %0 = load i32*, i32** @d, align 8
44  %tobool1 = icmp eq i32* %0, null
45  br i1 %tobool1, label %cond.false, label %cond.end
46
47cond.false:                                       ; preds = %for.body
48  call void @__assert_fail(i8* null)
49  unreachable
50
51cond.end:                                         ; preds = %for.body
52  %1 = load i32*, i32** @d, align 8
53  %cmp = icmp eq i32* %1, null
54  br i1 %cmp, label %cond.end4, label %cond.false3
55
56cond.false3:                                      ; preds = %cond.end
57  call void @__assert_fail(i8* null)
58  unreachable
59
60cond.end4:                                        ; preds = %cond.end
61  call void @__assert_fail(i8* null)
62  unreachable
63
64for.end:                                          ; No predecessors!
65  ret void
66}
67
68declare void @__assert_fail(i8*)
69
70; Function Attrs: noreturn nounwind
71declare void @llvm.trap() #0
72
73attributes #0 = { noreturn nounwind }
74