blob: 3756fcb82e42f4ef6f852191bea3dd0a53928cb5 [file] [log] [blame]
Reid Spencer64050992006-12-29 20:01:32 +00001; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis
Reid Spencera551c042007-04-15 09:21:47 +00002; END.
Reid Spencer266e42b2006-12-23 06:05:41 +00003; ModuleID = 'bugpoint-tooptimize.bc'
4target datalayout = "e-p:32:32"
5target endian = little
6target pointersize = 32
7target triple = "i686-pc-linux-gnu"
8 %struct.FILE = type { int, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, %struct._IO_marker*, %struct.FILE*, int, int, int, ushort, sbyte, [1 x sbyte], sbyte*, long, sbyte*, sbyte*, sbyte*, sbyte*, uint, int, [40 x sbyte] }
9 %struct._IO_FILE = type { int, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, %struct._IO_marker*, %struct.FILE*, int, int, int, ushort, sbyte, [1 x sbyte], sbyte*, long, sbyte*, sbyte*, sbyte*, sbyte*, uint, int, [40 x sbyte] }
10 %struct._IO_marker = type { %struct._IO_marker*, %struct.FILE*, int }
11 %struct.charsequence = type { sbyte*, uint, uint }
12 %struct.trie_s = type { [26 x %struct.trie_s*], int }
13%str = external global [14 x sbyte] ; <[14 x sbyte]*> [#uses=0]
14%str = external global [32 x sbyte] ; <[32 x sbyte]*> [#uses=0]
15%str = external global [12 x sbyte] ; <[12 x sbyte]*> [#uses=0]
16%C.0.2294 = external global %struct.charsequence ; <%struct.charsequence*> [#uses=3]
17%t = external global %struct.trie_s* ; <%struct.trie_s**> [#uses=0]
18%str = external global [3 x sbyte] ; <[3 x sbyte]*> [#uses=0]
19%str = external global [26 x sbyte] ; <[26 x sbyte]*> [#uses=0]
20
21implementation ; Functions:
22
23declare void %charsequence_reset(%struct.charsequence*)
24declare void %free(sbyte*)
25declare void %charsequence_push(%struct.charsequence*, sbyte)
26declare sbyte* %charsequence_val(%struct.charsequence*)
27declare int %_IO_getc(%struct.FILE*)
28declare int %tolower(int)
29declare %struct.trie_s* %trie_insert(%struct.trie_s*, sbyte*)
30declare int %feof(%struct.FILE*)
31
32void %addfile(%struct.trie_s* %t, %struct.FILE* %f) {
33entry:
34 %t_addr = alloca %struct.trie_s* ; <%struct.trie_s**> [#uses=2]
35 %f_addr = alloca %struct.FILE* ; <%struct.FILE**> [#uses=3]
36 %c = alloca sbyte, align 1 ; <sbyte*> [#uses=7]
37 %wstate = alloca int, align 4 ; <int*> [#uses=4]
38 %cs = alloca %struct.charsequence, align 16 ; <%struct.charsequence*> [#uses=7]
39 %str = alloca sbyte*, align 4 ; <sbyte**> [#uses=3]
40 "alloca point" = bitcast int 0 to int ; <int> [#uses=0]
41 store %struct.trie_s* %t, %struct.trie_s** %t_addr
42 store %struct.FILE* %f, %struct.FILE** %f_addr
43 store int 0, int* %wstate
44 %tmp = getelementptr %struct.charsequence* %cs, uint 0, uint 0 ; <sbyte**> [#uses=1]
45 %tmp1 = getelementptr %struct.charsequence* %C.0.2294, uint 0, uint 0 ; <sbyte**> [#uses=1]
46 %tmp = load sbyte** %tmp1 ; <sbyte*> [#uses=1]
47 store sbyte* %tmp, sbyte** %tmp
48 %tmp = getelementptr %struct.charsequence* %cs, uint 0, uint 1 ; <uint*> [#uses=1]
49 %tmp2 = getelementptr %struct.charsequence* %C.0.2294, uint 0, uint 1 ; <uint*> [#uses=1]
50 %tmp = load uint* %tmp2 ; <uint> [#uses=1]
51 store uint %tmp, uint* %tmp
52 %tmp3 = getelementptr %struct.charsequence* %cs, uint 0, uint 2 ; <uint*> [#uses=1]
53 %tmp4 = getelementptr %struct.charsequence* %C.0.2294, uint 0, uint 2 ; <uint*> [#uses=1]
54 %tmp5 = load uint* %tmp4 ; <uint> [#uses=1]
55 store uint %tmp5, uint* %tmp3
56 br label %bb33
57
58bb: ; preds = %bb33
59 %tmp = load %struct.FILE** %f_addr ; <%struct.FILE*> [#uses=1]
Reid Spencer2c3d9e62007-01-04 16:46:46 +000060 %tmp = call int %_IO_getc( %struct.FILE* %tmp ) ; <int> [#uses=1]
Reid Spencer266e42b2006-12-23 06:05:41 +000061 %tmp6 = call int %tolower( int %tmp ) ; <int> [#uses=1]
62 %tmp6 = trunc int %tmp6 to sbyte ; <sbyte> [#uses=1]
63 store sbyte %tmp6, sbyte* %c
64 %tmp7 = load int* %wstate ; <int> [#uses=1]
65 %tmp = icmp ne int %tmp7, 0 ; <bool> [#uses=1]
66 br bool %tmp, label %cond_true, label %cond_false
67
68cond_true: ; preds = %bb
69 %tmp = load sbyte* %c ; <sbyte> [#uses=1]
70 %tmp8 = icmp sle sbyte %tmp, 96 ; <bool> [#uses=1]
71 br bool %tmp8, label %cond_true9, label %cond_next
72
73cond_true9: ; preds = %cond_true
74 br label %bb16
75
76cond_next: ; preds = %cond_true
77 %tmp10 = load sbyte* %c ; <sbyte> [#uses=1]
78 %tmp11 = icmp sgt sbyte %tmp10, 122 ; <bool> [#uses=1]
79 br bool %tmp11, label %cond_true12, label %cond_next13
80
81cond_true12: ; preds = %cond_next
82 br label %bb16
83
84cond_next13: ; preds = %cond_next
85 %tmp14 = load sbyte* %c ; <sbyte> [#uses=1]
86 %tmp14 = sext sbyte %tmp14 to int ; <int> [#uses=1]
87 %tmp1415 = trunc int %tmp14 to sbyte ; <sbyte> [#uses=1]
88 call void %charsequence_push( %struct.charsequence* %cs, sbyte %tmp1415 )
89 br label %bb21
90
91bb16: ; preds = %cond_true12, %cond_true9
92 %tmp17 = call sbyte* %charsequence_val( %struct.charsequence* %cs ) ; <sbyte*> [#uses=1]
93 store sbyte* %tmp17, sbyte** %str
94 %tmp = load %struct.trie_s** %t_addr ; <%struct.trie_s*> [#uses=1]
95 %tmp18 = load sbyte** %str ; <sbyte*> [#uses=1]
96 %tmp19 = call %struct.trie_s* %trie_insert( %struct.trie_s* %tmp, sbyte* %tmp18 ) ; <%struct.trie_s*> [#uses=0]
97 %tmp20 = load sbyte** %str ; <sbyte*> [#uses=1]
98 call void %free( sbyte* %tmp20 )
99 store int 0, int* %wstate
100 br label %bb21
101
102bb21: ; preds = %bb16, %cond_next13
103 br label %cond_next32
104
105cond_false: ; preds = %bb
106 %tmp22 = load sbyte* %c ; <sbyte> [#uses=1]
107 %tmp23 = icmp sgt sbyte %tmp22, 96 ; <bool> [#uses=1]
108 br bool %tmp23, label %cond_true24, label %cond_next31
109
110cond_true24: ; preds = %cond_false
111 %tmp25 = load sbyte* %c ; <sbyte> [#uses=1]
112 %tmp26 = icmp sle sbyte %tmp25, 122 ; <bool> [#uses=1]
113 br bool %tmp26, label %cond_true27, label %cond_next30
114
115cond_true27: ; preds = %cond_true24
116 call void %charsequence_reset( %struct.charsequence* %cs )
117 %tmp28 = load sbyte* %c ; <sbyte> [#uses=1]
118 %tmp28 = sext sbyte %tmp28 to int ; <int> [#uses=1]
119 %tmp2829 = trunc int %tmp28 to sbyte ; <sbyte> [#uses=1]
120 call void %charsequence_push( %struct.charsequence* %cs, sbyte %tmp2829 )
121 store int 1, int* %wstate
122 br label %cond_next30
123
124cond_next30: ; preds = %cond_true27, %cond_true24
125 br label %cond_next31
126
127cond_next31: ; preds = %cond_next30, %cond_false
128 br label %cond_next32
129
130cond_next32: ; preds = %cond_next31, %bb21
131 br label %bb33
132
133bb33: ; preds = %cond_next32, %entry
134 %tmp34 = load %struct.FILE** %f_addr ; <%struct.FILE*> [#uses=1]
135 %tmp35 = call int %feof( %struct.FILE* %tmp34 ) ; <int> [#uses=1]
136 %tmp36 = icmp eq int %tmp35, 0 ; <bool> [#uses=1]
137 br bool %tmp36, label %bb, label %bb37
138
139bb37: ; preds = %bb33
140 br label %return
141
142return: ; preds = %bb37
143 ret void
144}
145