1; RUN: opt < %s -basicaa -gvn -S | FileCheck %s
2; This test is checking that (a) this doesn't crash, and (b) we don't
3; conclude the value of %tmp17 is available in bb1.bb15_crit_edge.
4; rdar://9429882
5
6target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
7target triple = "x86_64-apple-macosx10.7.0"
8
9define i1 @rb_intern() nounwind ssp {
10; CHECK-LABEL: @rb_intern(
11
12bb:
13  %tmp = alloca i8*, align 8
14  store i8* null, i8** %tmp, align 8
15  store i8 undef, i8* null, align 536870912
16  br label %bb1
17
18bb1:
19  br i1 undef, label %bb3, label %bb15
20
21; CHECK: bb1:
22; CHECK: [[TMP:%.*]] = phi i8* [ getelementptr (i8* null, i64 undef), %bb10 ], [ null, %bb ]
23
24; CHECK: bb1.bb15_crit_edge:
25; CHECK: %tmp17.pre = load i8* [[TMP]], align 1
26
27bb3:
28  call void @isalnum()
29  br i1 undef, label %bb10, label %bb5
30
31bb5:
32  br i1 undef, label %bb10, label %bb6
33
34bb6:
35  %tmp7 = load i8** %tmp, align 8
36  %tmp8 = load i8* %tmp7, align 1
37  %tmp9 = zext i8 %tmp8 to i64
38  br i1 undef, label %bb15, label %bb10
39
40bb10:
41  %tmp11 = load i8** %tmp, align 8
42  %tmp12 = load i8* %tmp11, align 1
43  %tmp13 = zext i8 %tmp12 to i64
44  %tmp14 = getelementptr inbounds i8* null, i64 undef
45  store i8* %tmp14, i8** %tmp, align 8
46  br label %bb1
47
48bb15:
49  %tmp16 = load i8** %tmp, align 8
50  %tmp17 = load i8* %tmp16, align 1
51  %tmp18 = icmp eq i8 %tmp17, 0
52  br label %bb19
53
54; CHECK: bb15:
55; CHECK: %tmp17 = phi i8 [ %tmp17.pre, %bb1.bb15_crit_edge ], [ %tmp8, %bb6 ]
56
57bb19:                                             ; preds = %bb15
58  ret i1 %tmp18
59}
60
61declare void @isalnum() nounwind inlinehint ssp
62