8ef66c2baae52a068694c138777b8d46b97e0f4b
[oota-llvm.git] / test / Transforms / GVN / crash-2.ll
1 ; RUN: opt -gvn -S %s
2 ; XFAIL: *
3 ; rdar://7438974
4
5 target 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"
6 target triple = "x86_64-apple-darwin9.0"
7
8 @g = external global i64, align 8
9
10 define i32* @foo() {
11 do.end17.i:
12   %tmp18.i = load i7** undef
13   %tmp1 = bitcast i7* %tmp18.i to i8*
14   br i1 undef, label %do.body36.i, label %if.then21.i
15
16 if.then21.i:
17   %tmp2 = bitcast i7* %tmp18.i to i8*
18   ret i32* undef
19
20 do.body36.i:
21   %ivar38.i = load i64* @g 
22   %tmp3 = bitcast i7* %tmp18.i to i8*
23   %add.ptr39.sum.i = add i64 %ivar38.i, 8
24   %tmp40.i = getelementptr inbounds i8* %tmp3, i64 %add.ptr39.sum.i
25   %tmp4 = bitcast i8* %tmp40.i to i64*
26   %tmp41.i = load i64* %tmp4
27   br i1 undef, label %if.then48.i, label %do.body57.i
28
29 if.then48.i:
30   %call54.i = call i32 @foo2()
31   br label %do.body57.i
32
33 do.body57.i:
34   %tmp58.i = load i7** undef
35   %ivar59.i = load i64* @g
36   %tmp5 = bitcast i7* %tmp58.i to i8*
37   %add.ptr65.sum.i = add i64 %ivar59.i, 8
38   %tmp66.i = getelementptr inbounds i8* %tmp5, i64 %add.ptr65.sum.i
39   %tmp6 = bitcast i8* %tmp66.i to i64*
40   %tmp67.i = load i64* %tmp6
41   ret i32* undef
42 }
43
44 declare i32 @foo2()