1 ;RUN: opt < %s -licm -S | grep {load } | count 4
2 ; ModuleID = '2009-02-27-licm.bc'
3 target 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:32:32"
4 target triple = "i386-pc-linux-gnu"
5 %llvm.dbg.anchor.type = type { i32, i32 }
6 %llvm.dbg.basictype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, i32 }
7 %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8*, i1, i1, i8*, i32 }
8 %llvm.dbg.composite.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, { }*, { }*, i32 }
9 %llvm.dbg.subprogram.type = type { i32, { }*, { }*, i8*, i8*, i8*, { }*, i32, { }*, i1, i1 }
10 @llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 17 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1]
11 @.str = internal constant [12 x i8] c"mt19937ar.c\00", section "llvm.metadata" ; <[12 x i8]*> [#uses=1]
12 @.str1 = internal constant [58 x i8] c"/developer2/home5/youxiangc/work/project/pr965/test-licm/\00", section "llvm.metadata" ; <[58 x i8]*> [#uses=1]
13 @.str2 = internal constant [52 x i8] c"4.2.1 (Based on Apple Inc. build 5641) (LLVM build)\00", section "llvm.metadata" ; <[52 x i8]*> [#uses=1]
14 @llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { i32 458769, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to { }*), i32 1, i8* getelementptr ([12 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([58 x i8]* @.str1, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0), i1 true, i1 false, i8* null, i32 0 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
15 @mti = internal global i32 625 ; <i32*> [#uses=7]
16 @.str5 = internal constant [18 x i8] c"long unsigned int\00", section "llvm.metadata" ; <[18 x i8]*> [#uses=1]
17 @llvm.dbg.basictype6 = internal constant %llvm.dbg.basictype.type { i32 458788, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([18 x i8]* @.str5, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, i32 7 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1]
18 @llvm.dbg.array = internal constant [2 x { }*] [{ }* null, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype6 to { }*)], section "llvm.metadata" ; <[2 x { }*]*> [#uses=1]
19 @llvm.dbg.composite = internal constant %llvm.dbg.composite.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 0, i64 0, i64 0, i32 0, { }* null, { }* bitcast ([2 x { }*]* @llvm.dbg.array to { }*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
20 @llvm.dbg.subprograms = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 46 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1]
21 @.str7 = internal constant [13 x i8] c"init_genrand\00", section "llvm.metadata" ; <[13 x i8]*> [#uses=1]
22 @llvm.dbg.subprogram = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([13 x i8]* @.str7, i32 0, i32 0), i8* getelementptr ([13 x i8]* @.str7, i32 0, i32 0), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 13, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite to { }*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
23 @mt = internal global [624 x i32] zeroinitializer, align 32 ; <[624 x i32]*> [#uses=4]
25 define void @init_genrand(i32 %s) nounwind {
27 tail call void @llvm.dbg.func.start({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*))
28 tail call void @llvm.dbg.stoppoint(i32 14, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
29 store i32 %s, i32* getelementptr ([624 x i32]* @mt, i32 0, i32 0), align 32
30 tail call void @llvm.dbg.stoppoint(i32 15, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
31 store i32 1, i32* @mti
32 tail call void @llvm.dbg.stoppoint(i32 15, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
33 %0 = load i32* @mti, align 4 ; <i32> [#uses=1]
34 %1 = icmp sgt i32 %0, 623 ; <i1> [#uses=1]
35 br i1 %1, label %return, label %bb.nph
37 bb.nph: ; preds = %entry
40 bb: ; preds = %bb1, %bb.nph
41 %storemerge1 = phi i32 [ %16, %bb1 ], [ 1, %bb.nph ] ; <i32> [#uses=0]
42 tail call void @llvm.dbg.stoppoint(i32 16, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
43 %2 = load i32* @mti, align 4 ; <i32> [#uses=3]
44 %3 = add i32 %2, -1 ; <i32> [#uses=1]
45 %4 = getelementptr [624 x i32]* @mt, i32 0, i32 %3 ; <i32*> [#uses=1]
46 %5 = load i32* %4, align 4 ; <i32> [#uses=1]
47 %6 = add i32 %2, -1 ; <i32> [#uses=1]
48 %7 = getelementptr [624 x i32]* @mt, i32 0, i32 %6 ; <i32*> [#uses=1]
49 %8 = load i32* %7, align 4 ; <i32> [#uses=1]
50 %9 = lshr i32 %8, 30 ; <i32> [#uses=1]
51 %10 = xor i32 %9, %5 ; <i32> [#uses=1]
52 %11 = mul i32 %10, 1812433253 ; <i32> [#uses=1]
53 %12 = load i32* @mti, align 4 ; <i32> [#uses=1]
54 %13 = add i32 %11, %12 ; <i32> [#uses=1]
55 %14 = getelementptr [624 x i32]* @mt, i32 0, i32 %2 ; <i32*> [#uses=1]
56 store i32 %13, i32* %14, align 4
57 tail call void @llvm.dbg.stoppoint(i32 15, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
58 %15 = load i32* @mti, align 4 ; <i32> [#uses=1]
59 %16 = add i32 %15, 1 ; <i32> [#uses=2]
63 %storemerge = phi i32 [ %16, %bb ] ; <i32> [#uses=1]
64 store i32 %storemerge, i32* @mti
65 tail call void @llvm.dbg.stoppoint(i32 15, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
66 %17 = load i32* @mti, align 4 ; <i32> [#uses=1]
67 %18 = icmp sgt i32 %17, 623 ; <i1> [#uses=1]
68 br i1 %18, label %bb1.return_crit_edge, label %bb
70 bb1.return_crit_edge: ; preds = %bb1
73 return: ; preds = %bb1.return_crit_edge, %entry
74 tail call void @llvm.dbg.stoppoint(i32 25, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
75 tail call void @llvm.dbg.region.end({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*))
79 declare void @llvm.dbg.func.start({ }*) nounwind
81 declare void @llvm.dbg.stoppoint(i32, i32, { }*) nounwind
83 declare void @llvm.dbg.region.end({ }*) nounwind