1; RUN: opt -globalopt -disable-output < %s
2target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32"
3target triple = "i386-apple-darwin9.8"
4
5%0 = type { i32, void ()* }
6%struct.btSimdScalar = type { %"union.btSimdScalar::$_14" }
7%"union.btSimdScalar::$_14" = type { <4 x float> }
8
9@_ZL6vTwist =  global %struct.btSimdScalar zeroinitializer ; <%struct.btSimdScalar*> [#uses=1]
10@llvm.global_ctors = appending global [1 x %0] [%0 { i32 65535, void ()* @_GLOBAL__I__ZN21btConeTwistConstraintC2Ev }] ; <[12 x %0]*> [#uses=0]
11
12define internal void @_GLOBAL__I__ZN21btConeTwistConstraintC2Ev() nounwind section "__TEXT,__StaticInit,regular,pure_instructions" {
13entry:
14  store float 1.0, float* getelementptr inbounds (%struct.btSimdScalar, %struct.btSimdScalar* @_ZL6vTwist, i32 0, i32 0, i32 0, i32 3), align 4
15  ret void
16}
17
18
19; PR6760
20%T = type { [5 x i32] }
21
22@switch_inf = internal global %T* null
23
24define void @test(i8* %arch_file, i32 %route_type) {
25entry:
26  %A = sext i32 1 to i64
27  %B = mul i64 %A, 20
28  %C = call noalias i8* @malloc(i64 %B) nounwind
29  %D = bitcast i8* %C to %T*
30  store %T* %D, %T** @switch_inf, align 8
31  unreachable
32
33bb.nph.i:
34  %scevgep.i539 = getelementptr i8, i8* %C, i64 4
35  unreachable
36
37xx:
38  %E = load %T*, %T** @switch_inf, align 8
39  unreachable
40}
41
42declare noalias i8* @malloc(i64) nounwind
43
44
45; PR8063
46@permute_bitrev.bitrev = internal global i32* null, align 8
47define void @permute_bitrev() nounwind {
48entry:
49  %tmp = load i32*, i32** @permute_bitrev.bitrev, align 8
50  %conv = sext i32 0 to i64
51  %mul = mul i64 %conv, 4
52  %call = call i8* @malloc(i64 %mul)
53  %0 = bitcast i8* %call to i32*
54  store i32* %0, i32** @permute_bitrev.bitrev, align 8
55  ret void
56}
57
58
59
60
61@data8 = internal global [8000 x i8] zeroinitializer, align 16
62define void @memset_with_strange_user() ssp {
63  call void @llvm.memset.p0i8.i64(i8* getelementptr inbounds ([8000 x i8], [8000 x i8]* @data8, i64 0, i64 0), i8 undef, i64 ptrtoint (i8* getelementptr ([8000 x i8], [8000 x i8]* @data8, i64 1, i64 sub (i64 0, i64 ptrtoint ([8000 x i8]* @data8 to i64))) to i64), i32 16, i1 false)
64  ret void
65}
66declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1) nounwind
67
68
69; PR9856
70@g_52 = internal global i32** null, align 8
71@g_90 = external global i32*, align 8
72
73define void @icmp_user_of_stored_once() nounwind ssp {
74entry:
75  %tmp4 = load i32**, i32*** @g_52, align 8
76  store i32** @g_90, i32*** @g_52
77  %cmp17 = icmp ne i32*** undef, @g_52
78  ret void
79}
80
81