Chris Lattner | 867be59 | 2011-01-24 03:29:07 +0000 | [diff] [blame] | 1 | ; RUN: opt -scalarrepl %s -disable-output |
| 2 | ; RUN: opt -scalarrepl-ssa %s -disable-output |
| 3 | |
| 4 | 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" |
| 5 | target triple = "x86_64-apple-darwin10.0.0" |
| 6 | |
| 7 | ; PR9017 |
| 8 | define void @test1() nounwind readnone ssp { |
| 9 | entry: |
| 10 | %l_72 = alloca i32*, align 8 |
| 11 | unreachable |
| 12 | |
| 13 | for.cond: ; preds = %for.cond |
| 14 | %tmp1.i = load i32** %l_72, align 8 |
| 15 | store i32* %tmp1.i, i32** %l_72, align 8 |
| 16 | br label %for.cond |
| 17 | |
| 18 | if.end: ; No predecessors! |
| 19 | ret void |
| 20 | } |
Chris Lattner | 850bdd2 | 2011-01-24 03:37:34 +0000 | [diff] [blame] | 21 | |
| 22 | |
| 23 | define void @test2() { |
| 24 | %E = alloca { { i32, float, double, i64 }, { i32, float, double, i64 } } ; <{ { i32, float, double, i64 }, { i32, float, double, i64 } }*> [#uses=1] |
| 25 | %tmp.151 = getelementptr { { i32, float, double, i64 }, { i32, float, double, i64 } }* %E, i64 0, i32 1, i32 3 ; <i64*> [#uses=0] |
| 26 | ret void |
| 27 | } |
| 28 | |
| 29 | define i32 @test3() { |
| 30 | %X = alloca { [4 x i32] } ; <{ [4 x i32] }*> [#uses=1] |
| 31 | %Y = getelementptr { [4 x i32] }* %X, i64 0, i32 0, i64 2 ; <i32*> [#uses=2] |
| 32 | store i32 4, i32* %Y |
| 33 | %Z = load i32* %Y ; <i32> [#uses=1] |
| 34 | ret i32 %Z |
| 35 | } |
| 36 | |
| 37 | |
| 38 | %struct.rtx_def = type { [2 x i8], i32, [1 x %union.rtunion_def] } |
| 39 | %union.rtunion_def = type { i32 } |
| 40 | |
| 41 | define void @test4() { |
| 42 | entry: |
| 43 | %c_addr.i = alloca i8 ; <i8*> [#uses=1] |
| 44 | switch i32 0, label %return [ |
| 45 | i32 36, label %label.7 |
| 46 | i32 34, label %label.7 |
| 47 | i32 41, label %label.5 |
| 48 | ] |
| 49 | label.5: ; preds = %entry |
| 50 | ret void |
| 51 | label.7: ; preds = %entry, %entry |
| 52 | br i1 false, label %then.4, label %switchexit.0 |
| 53 | then.4: ; preds = %label.7 |
| 54 | %tmp.0.i = bitcast i8* %c_addr.i to i32* ; <i32*> [#uses=1] |
| 55 | store i32 44, i32* %tmp.0.i |
| 56 | ret void |
| 57 | switchexit.0: ; preds = %label.7 |
| 58 | ret void |
| 59 | return: ; preds = %entry |
| 60 | ret void |
| 61 | } |
| 62 | |
| 63 | |
| 64 | define void @test5() { |
| 65 | entry: |
| 66 | %source_ptr = alloca i8*, align 4 ; <i8**> [#uses=2] |
| 67 | br i1 false, label %bb1357, label %cond_next583 |
| 68 | cond_next583: ; preds = %entry |
| 69 | ret void |
| 70 | bb1357: ; preds = %entry |
| 71 | br i1 false, label %bb1365, label %bb27055 |
| 72 | bb1365: ; preds = %bb1357 |
| 73 | switch i32 0, label %cond_next10377 [ |
| 74 | i32 0, label %bb4679 |
| 75 | i32 1, label %bb4679 |
| 76 | i32 2, label %bb4679 |
| 77 | i32 3, label %bb4679 |
| 78 | i32 4, label %bb5115 |
| 79 | i32 5, label %bb6651 |
| 80 | i32 6, label %bb7147 |
| 81 | i32 7, label %bb8683 |
| 82 | i32 8, label %bb9131 |
| 83 | i32 9, label %bb9875 |
| 84 | i32 10, label %bb4679 |
| 85 | i32 11, label %bb4859 |
| 86 | i32 12, label %bb4679 |
| 87 | i32 16, label %bb10249 |
| 88 | ] |
| 89 | bb4679: ; preds = %bb1365, %bb1365, %bb1365, %bb1365, %bb1365, %bb1365 |
| 90 | ret void |
| 91 | bb4859: ; preds = %bb1365 |
| 92 | ret void |
| 93 | bb5115: ; preds = %bb1365 |
| 94 | ret void |
| 95 | bb6651: ; preds = %bb1365 |
| 96 | ret void |
| 97 | bb7147: ; preds = %bb1365 |
| 98 | ret void |
| 99 | bb8683: ; preds = %bb1365 |
| 100 | ret void |
| 101 | bb9131: ; preds = %bb1365 |
| 102 | ret void |
| 103 | bb9875: ; preds = %bb1365 |
| 104 | %source_ptr9884 = bitcast i8** %source_ptr to i8** ; <i8**> [#uses=1] |
| 105 | %tmp9885 = load i8** %source_ptr9884 ; <i8*> [#uses=0] |
| 106 | ret void |
| 107 | bb10249: ; preds = %bb1365 |
| 108 | %source_ptr10257 = bitcast i8** %source_ptr to i16** ; <i16**> [#uses=1] |
| 109 | %tmp10258 = load i16** %source_ptr10257 ; <i16*> [#uses=0] |
| 110 | ret void |
| 111 | cond_next10377: ; preds = %bb1365 |
| 112 | ret void |
| 113 | bb27055: ; preds = %bb1357 |
| 114 | ret void |
| 115 | } |
| 116 | |
| 117 | |
| 118 | %"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator<char>::_Alloc_block*>" = type { %"struct.__gnu_cxx::bitmap_allocator<char>::_Alloc_block"* } |
| 119 | %"struct.__gnu_cxx::bitmap_allocator<char>" = type { i8 } |
| 120 | %"struct.__gnu_cxx::bitmap_allocator<char>::_Alloc_block" = type { [8 x i8] } |
| 121 | |
| 122 | ; PR1045 |
| 123 | define void @test6() { |
| 124 | entry: |
| 125 | %this_addr.i = alloca %"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator<char>::_Alloc_block*>"* ; <%"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator<char>::_Alloc_block*>"**> [#uses=3] |
| 126 | %tmp = alloca %"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator<char>::_Alloc_block*>", align 4 ; <%"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator<char>::_Alloc_block*>"*> [#uses=1] |
| 127 | store %"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator<char>::_Alloc_block*>"* %tmp, %"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator<char>::_Alloc_block*>"** %this_addr.i |
| 128 | %tmp.i = load %"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator<char>::_Alloc_block*>"** %this_addr.i ; <%"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator<char>::_Alloc_block*>"*> [#uses=1] |
| 129 | %tmp.i.upgrd.1 = bitcast %"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator<char>::_Alloc_block*>"* %tmp.i to %"struct.__gnu_cxx::bitmap_allocator<char>"* ; <%"struct.__gnu_cxx::bitmap_allocator<char>"*> [#uses=0] |
| 130 | %tmp1.i = load %"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator<char>::_Alloc_block*>"** %this_addr.i ; <%"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator<char>::_Alloc_block*>"*> [#uses=1] |
| 131 | %tmp.i.upgrd.2 = getelementptr %"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator<char>::_Alloc_block*>"* %tmp1.i, i32 0, i32 0 ; <%"struct.__gnu_cxx::bitmap_allocator<char>::_Alloc_block"**> [#uses=0] |
| 132 | unreachable |
| 133 | } |
| 134 | |
| 135 | %struct.CGPoint = type { float, float } |
| 136 | %struct.aal_big_range_t = type { i32, i32 } %struct.aal_callback_t = type { i8* (i8*, i32)*, void (i8*, i8*)* } %struct.aal_edge_pool_t = type { %struct.aal_edge_pool_t*, i32, i32, [0 x %struct.aal_edge_t] } %struct.aal_edge_t = type { %struct.CGPoint, %struct.CGPoint, i32 } |
| 137 | %struct.aal_range_t = type { i16, i16 } |
| 138 | %struct.aal_span_pool_t = type { %struct.aal_span_pool_t*, [341 x %struct.aal_span_t] } |
| 139 | %struct.aal_span_t = type { %struct.aal_span_t*, %struct.aal_big_range_t } |
| 140 | %struct.aal_spanarray_t = type { [2 x %struct.aal_range_t] } |
| 141 | %struct.aal_spanbucket_t = type { i16, [2 x i8], %struct.anon } |
| 142 | %struct.aal_state_t = type { %struct.CGPoint, %struct.CGPoint, %struct.CGPoint, i32, float, float, float, float, %struct.CGPoint, %struct.CGPoint, float, float, float, float, i32, i32, i32, i32, float, float, i8*, i32, i32, %struct.aal_edge_pool_t*, %struct.aal_edge_pool_t*, i8*, %struct.aal_callback_t*, i32, %struct.aal_span_t*, %struct.aal_span_t*, %struct.aal_span_t*, %struct.aal_span_pool_t*, i8, float, i8, i32 } |
| 143 | %struct.anon = type { %struct.aal_spanarray_t } |
| 144 | |
| 145 | |
Chris Lattner | 850bdd2 | 2011-01-24 03:37:34 +0000 | [diff] [blame] | 146 | |
| 147 | define fastcc void @test7() { |
| 148 | entry: |
| 149 | %SB = alloca %struct.aal_spanbucket_t, align 4 ; <%struct.aal_spanbucket_t*> [#uses=2] |
| 150 | br i1 false, label %cond_true, label %cond_next79 |
| 151 | |
| 152 | cond_true: ; preds = %entry |
| 153 | br i1 false, label %cond_next, label %cond_next114.i |
| 154 | |
| 155 | cond_next114.i: ; preds = %cond_true |
| 156 | ret void |
| 157 | |
| 158 | cond_next: ; preds = %cond_true |
| 159 | %SB19 = bitcast %struct.aal_spanbucket_t* %SB to i8* ; <i8*> [#uses=1] |
Chris Lattner | b85e4eb | 2011-06-18 06:05:24 +0000 | [diff] [blame] | 160 | call void @llvm.memcpy.p0i8.p0i8.i32(i8* %SB19, i8* null, i32 12, i32 0, i1 false) |
Chris Lattner | 850bdd2 | 2011-01-24 03:37:34 +0000 | [diff] [blame] | 161 | br i1 false, label %cond_next34, label %cond_next79 |
| 162 | |
| 163 | cond_next34: ; preds = %cond_next |
| 164 | %i.2.reload22 = load i32* null ; <i32> [#uses=1] |
| 165 | %tmp51 = getelementptr %struct.aal_spanbucket_t* %SB, i32 0, i32 2, i32 0, i32 0, i32 %i.2.reload22, i32 1 |
| 166 | ; <i16*> [#uses=0] |
| 167 | ret void |
| 168 | |
| 169 | cond_next79: ; preds = %cond_next, %entry |
| 170 | ret void |
| 171 | } |
| 172 | |
| 173 | |
| 174 | %struct.c37304a__vrec = type { i8, %struct.c37304a__vrec___disc___XVN } |
| 175 | %struct.c37304a__vrec___disc___XVN = type { |
| 176 | %struct.c37304a__vrec___disc___XVN___O } |
| 177 | %struct.c37304a__vrec___disc___XVN___O = type { } |
| 178 | |
| 179 | ; PR3304 |
| 180 | define void @test8() { |
| 181 | entry: |
| 182 | %v = alloca %struct.c37304a__vrec |
| 183 | %0 = getelementptr %struct.c37304a__vrec* %v, i32 0, i32 0 |
| 184 | store i8 8, i8* %0, align 1 |
| 185 | unreachable |
| 186 | } |
| 187 | |
| 188 | |
| 189 | |
| 190 | ; rdar://6808691 - ZeroLengthMemSet |
Chris Lattner | a53616d | 2011-06-19 00:03:46 +0000 | [diff] [blame] | 191 | %0 = type <{ i32, i16, i8, i8, i64, i64, i16, [0 x i16] }> |
Chris Lattner | 850bdd2 | 2011-01-24 03:37:34 +0000 | [diff] [blame] | 192 | |
| 193 | define i32 @test9() { |
| 194 | entry: |
| 195 | %.compoundliteral = alloca %0 |
| 196 | %tmp228 = getelementptr %0* %.compoundliteral, i32 0, i32 7 |
| 197 | %tmp229 = bitcast [0 x i16]* %tmp228 to i8* |
Chris Lattner | b85e4eb | 2011-06-18 06:05:24 +0000 | [diff] [blame] | 198 | call void @llvm.memset.p0i8.i64(i8* %tmp229, i8 0, i64 0, i32 2, i1 false) |
Chris Lattner | 850bdd2 | 2011-01-24 03:37:34 +0000 | [diff] [blame] | 199 | unreachable |
| 200 | } |
| 201 | |
| 202 | declare void @llvm.memset.i64(i8* nocapture, i8, i64, i32) nounwind |
| 203 | |
| 204 | |
| 205 | ; PR4146 - i1 handling |
| 206 | %wrapper = type { i1 } |
| 207 | define void @test10() { |
| 208 | entry: |
| 209 | %w = alloca %wrapper, align 8 ; <%wrapper*> [#uses=1] |
| 210 | %0 = getelementptr %wrapper* %w, i64 0, i32 0 ; <i1*> |
| 211 | store i1 true, i1* %0 |
| 212 | ret void |
| 213 | } |
| 214 | |
| 215 | |
| 216 | %struct.singlebool = type <{ i8 }> |
| 217 | ; PR4286 |
| 218 | define zeroext i8 @test11() nounwind { |
| 219 | entry: |
| 220 | %a = alloca %struct.singlebool, align 1 ; <%struct.singlebool*> [#uses=2] |
| 221 | %storetmp.i = bitcast %struct.singlebool* %a to i1* ; <i1*> [#uses=1] |
| 222 | store i1 true, i1* %storetmp.i |
| 223 | %tmp = getelementptr %struct.singlebool* %a, i64 0, i32 0 ; <i8*> [#uses=1] |
| 224 | %tmp1 = load i8* %tmp ; <i8> [#uses=1] |
| 225 | ret i8 %tmp1 |
| 226 | } |
| 227 | |
| 228 | |
| 229 | %struct.Item = type { [4 x i16], %struct.rule* } |
| 230 | %struct.rule = type { [4 x i16], i32, i32, i32, %struct.nonterminal*, %struct.pattern*, i8 } |
| 231 | %struct.nonterminal = type { i8*, i32, i32, i32, %struct.plankMap*, %struct.rule* } |
| 232 | %struct.plankMap = type { %struct.list*, i32, %struct.stateMap* } |
| 233 | %struct.list = type { i8*, %struct.list* } |
| 234 | %struct.stateMap = type { i8*, %struct.plank*, i32, i16* } |
| 235 | %struct.plank = type { i8*, %struct.list*, i32 } |
| 236 | %struct.pattern = type { %struct.nonterminal*, %struct.operator*, [2 x %struct.nonterminal*] } |
| 237 | %struct.operator = type { i8*, i8, i32, i32, i32, i32, %struct.table* } |
| 238 | %struct.table = type { %struct.operator*, %struct.list*, i16*, [2 x %struct.dimension*], %struct.item_set** } |
| 239 | %struct.dimension = type { i16*, %struct.Index_Map, %struct.mapping*, i32, %struct.plankMap* } |
| 240 | %struct.Index_Map = type { i32, %struct.item_set** } |
| 241 | %struct.item_set = type { i32, i32, %struct.operator*, [2 x %struct.item_set*], %struct.item_set*, i16*, %struct.Item*, %struct.Item* } |
| 242 | %struct.mapping = type { %struct.list**, i32, i32, i32, %struct.item_set** } |
| 243 | |
| 244 | ; VLAs. |
| 245 | define void @test12() { |
| 246 | bb4.i: |
Chris Lattner | 26b0000 | 2011-06-17 03:14:27 +0000 | [diff] [blame] | 247 | %malloccall = tail call i8* @malloc(i32 0) |
| 248 | %0 = bitcast i8* %malloccall to [0 x %struct.Item]* |
Chris Lattner | 850bdd2 | 2011-01-24 03:37:34 +0000 | [diff] [blame] | 249 | %.sub.i.c.i = getelementptr [0 x %struct.Item]* %0, i32 0, i32 0 ; <%struct.Item*> [#uses=0] |
| 250 | unreachable |
| 251 | } |
Chris Lattner | 26b0000 | 2011-06-17 03:14:27 +0000 | [diff] [blame] | 252 | declare noalias i8* @malloc(i32) |
Chris Lattner | 850bdd2 | 2011-01-24 03:37:34 +0000 | [diff] [blame] | 253 | |
| 254 | ; PR8680 |
| 255 | define void @test13() nounwind { |
| 256 | entry: |
| 257 | %memtmp = alloca i32, align 4 |
| 258 | %0 = bitcast i32* %memtmp to void ()* |
| 259 | call void %0() nounwind |
| 260 | ret void |
| 261 | } |
Chris Lattner | b85e4eb | 2011-06-18 06:05:24 +0000 | [diff] [blame] | 262 | |
| 263 | declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind |
| 264 | declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1) nounwind |