1 ; RUN: llc < %s -mtriple=arm-apple-darwin -relocation-model=pic -mattr=+v6 2 ; PR1609 3 4 %struct.FILE = type { i8*, i32, i32, i16, i16, %struct.__sbuf, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %struct.__sbuf, %struct.__sFILEX*, i32, [3 x i8], [1 x i8], %struct.__sbuf, i32, i64 } 5 %struct.__sFILEX = type opaque 6 %struct.__sbuf = type { i8*, i32 } 7 @_C_nextcmd = external global i32 ; <i32*> [#uses=2] 8 @_C_cmds = external global [100 x i8*] ; <[100 x i8*]*> [#uses=2] 9 @.str44 = external constant [2 x i8] ; <[2 x i8]*> [#uses=1] 10 11 define i32 @main(i32 %argc, i8** %argv) { 12 entry: 13 br label %cond_next212.i 14 15 bb21.i: ; preds = %cond_next212.i 16 br label %cond_next212.i 17 18 bb24.i: ; preds = %cond_next212.i 19 ret i32 0 20 21 bb27.i: ; preds = %cond_next212.i 22 ret i32 0 23 24 bb30.i: ; preds = %cond_next212.i 25 %tmp205399.i = add i32 %argc_addr.2358.0.i, -1 ; <i32> [#uses=1] 26 br label %cond_next212.i 27 28 bb33.i: ; preds = %cond_next212.i 29 ret i32 0 30 31 cond_next73.i: ; preds = %cond_next212.i 32 ret i32 0 33 34 bb75.i: ; preds = %cond_next212.i 35 ret i32 0 36 37 bb77.i: ; preds = %cond_next212.i 38 ret i32 0 39 40 bb79.i: ; preds = %cond_next212.i 41 ret i32 0 42 43 bb102.i: ; preds = %cond_next212.i 44 br i1 false, label %cond_true110.i, label %cond_next123.i 45 46 cond_true110.i: ; preds = %bb102.i 47 %tmp116.i = getelementptr i8** %argv_addr.2321.0.i, i32 2 ; <i8**> [#uses=1] 48 %tmp117.i = load i8** %tmp116.i ; <i8*> [#uses=1] 49 %tmp126425.i = call %struct.FILE* @fopen( i8* %tmp117.i, i8* getelementptr ([2 x i8]* @.str44, i32 0, i32 0) ) ; <%struct.FILE*> [#uses=0] 50 ret i32 0 51 52 cond_next123.i: ; preds = %bb102.i 53 %tmp122.i = getelementptr i8* %tmp215.i, i32 2 ; <i8*> [#uses=0] 54 ret i32 0 55 56 bb162.i: ; preds = %cond_next212.i 57 ret i32 0 58 59 C_addcmd.exit120.i: ; preds = %cond_next212.i 60 %tmp3.i.i.i.i105.i = call i8* @calloc( i32 15, i32 1 ) ; <i8*> [#uses=1] 61 %tmp1.i108.i = getelementptr [100 x i8*]* @_C_cmds, i32 0, i32 0 ; <i8**> [#uses=1] 62 store i8* %tmp3.i.i.i.i105.i, i8** %tmp1.i108.i, align 4 63 %tmp.i91.i = load i32* @_C_nextcmd, align 4 ; <i32> [#uses=1] 64 store i32 0, i32* @_C_nextcmd, align 4 65 %tmp3.i.i.i.i95.i = call i8* @calloc( i32 15, i32 1 ) ; <i8*> [#uses=1] 66 %tmp1.i98.i = getelementptr [100 x i8*]* @_C_cmds, i32 0, i32 %tmp.i91.i ; <i8**> [#uses=1] 67 store i8* %tmp3.i.i.i.i95.i, i8** %tmp1.i98.i, align 4 68 br label %cond_next212.i 69 70 bb174.i: ; preds = %cond_next212.i 71 ret i32 0 72 73 bb192.i: ; preds = %cond_next212.i 74 br label %cond_next212.i 75 76 cond_next212.i: ; preds = %cond_next212.i, %cond_next212.i, %cond_next212.i, %cond_next212.i, %bb192.i, %C_addcmd.exit120.i, %bb30.i, %bb21.i, %entry 77 %max_d.3 = phi i32 [ -1, %entry ], [ %max_d.3, %bb30.i ], [ %max_d.3, %bb21.i ], [ %max_d.3, %C_addcmd.exit120.i ], [ 0, %bb192.i ], [ %max_d.3, %cond_next212.i ], [ %max_d.3, %cond_next212.i ], [ %max_d.3, %cond_next212.i ], [ %max_d.3, %cond_next212.i ] ; <i32> [#uses=7] 78 %argv_addr.2321.0.i = phi i8** [ %argv, %entry ], [ %tmp214.i, %bb192.i ], [ %tmp214.i, %C_addcmd.exit120.i ], [ %tmp214.i, %bb30.i ], [ %tmp214.i, %bb21.i ], [ %tmp214.i, %cond_next212.i ], [ %tmp214.i, %cond_next212.i ], [ %tmp214.i, %cond_next212.i ], [ %tmp214.i, %cond_next212.i ] ; <i8**> [#uses=2] 79 %argc_addr.2358.0.i = phi i32 [ %argc, %entry ], [ %tmp205399.i, %bb30.i ], [ 0, %bb21.i ], [ 0, %C_addcmd.exit120.i ], [ 0, %bb192.i ], [ 0, %cond_next212.i ], [ 0, %cond_next212.i ], [ 0, %cond_next212.i ], [ 0, %cond_next212.i ] ; <i32> [#uses=1] 80 %tmp214.i = getelementptr i8** %argv_addr.2321.0.i, i32 1 ; <i8**> [#uses=9] 81 %tmp215.i = load i8** %tmp214.i ; <i8*> [#uses=1] 82 %tmp1314.i = sext i8 0 to i32 ; <i32> [#uses=1] 83 switch i32 %tmp1314.i, label %bb192.i [ 84 i32 76, label %C_addcmd.exit120.i 85 i32 77, label %bb174.i 86 i32 83, label %bb162.i 87 i32 97, label %bb33.i 88 i32 98, label %bb21.i 89 i32 99, label %bb24.i 90 i32 100, label %bb27.i 91 i32 101, label %cond_next212.i 92 i32 102, label %bb102.i 93 i32 105, label %bb75.i 94 i32 109, label %bb30.i 95 i32 113, label %cond_next212.i 96 i32 114, label %cond_next73.i 97 i32 115, label %bb79.i 98 i32 116, label %cond_next212.i 99 i32 118, label %bb77.i 100 i32 119, label %cond_next212.i 101 ] 102 } 103 104 declare %struct.FILE* @fopen(i8*, i8*) 105 106 declare i8* @calloc(i32, i32) 107