1; RUN: opt < %s -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 | llvm-dis 2; END. 3 4; ModuleID = '2006-12-08-Ptr-ICmp-Branch.ll' 5target datalayout = "e-p:32:32" 6target triple = "i686-pc-linux-gnu" 7 %struct.FILE = type { i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i16, i8, [1 x i8], ptr, i64, ptr, ptr, ptr, ptr, i32, i32, [40 x i8] } 8 %struct._IO_FILE = type { i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i16, i8, [1 x i8], ptr, i64, ptr, ptr, ptr, ptr, i32, i32, [40 x i8] } 9 %struct._IO_marker = type { ptr, ptr, i32 } 10 %struct.charsequence = type { ptr, i32, i32 } 11 %struct.trie_s = type { [26 x ptr], i32 } 12@str = external global [14 x i8] ; <ptr> [#uses=0] 13@str.upgrd.1 = external global [32 x i8] ; <ptr> [#uses=0] 14@str.upgrd.2 = external global [12 x i8] ; <ptr> [#uses=0] 15@C.0.2294 = external global %struct.charsequence ; <ptr> [#uses=3] 16@t = external global ptr ; <ptr> [#uses=0] 17@str.upgrd.3 = external global [3 x i8] ; <ptr> [#uses=0] 18@str.upgrd.4 = external global [26 x i8] ; <ptr> [#uses=0] 19 20declare void @charsequence_reset(ptr) 21 22declare void @free(ptr) 23 24declare void @charsequence_push(ptr, i8) 25 26declare ptr @charsequence_val(ptr) 27 28declare i32 @_IO_getc(ptr) 29 30declare i32 @tolower(i32) 31 32declare ptr @trie_insert(ptr, ptr) 33 34declare i32 @feof(ptr) 35 36define void @addfile(ptr %t, ptr %f) { 37entry: 38 %t_addr = alloca ptr ; <ptr> [#uses=2] 39 %f_addr = alloca ptr ; <ptr> [#uses=3] 40 %c = alloca i8, align 1 ; <ptr> [#uses=7] 41 %wstate = alloca i32, align 4 ; <ptr> [#uses=4] 42 %cs = alloca %struct.charsequence, align 16 ; <ptr> [#uses=7] 43 %str = alloca ptr, align 4 ; <ptr> [#uses=3] 44 %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0] 45 store ptr %t, ptr %t_addr 46 store ptr %f, ptr %f_addr 47 store i32 0, ptr %wstate 48 %tmp = getelementptr %struct.charsequence, ptr %cs, i64 0, i32 0 ; <ptr> [#uses=1] 49 %tmp1 = getelementptr %struct.charsequence, ptr @C.0.2294, i64 0, i32 0 ; <ptr> [#uses=1] 50 %tmp.upgrd.5 = load ptr, ptr %tmp1 ; <ptr> [#uses=1] 51 store ptr %tmp.upgrd.5, ptr %tmp 52 %tmp.upgrd.6 = getelementptr %struct.charsequence, ptr %cs, i64 0, i32 1 ; <ptr> [#uses=1] 53 %tmp2 = getelementptr %struct.charsequence, ptr @C.0.2294, i64 0, i32 1 ; <ptr> [#uses=1] 54 %tmp.upgrd.7 = load i32, ptr %tmp2 ; <i32> [#uses=1] 55 store i32 %tmp.upgrd.7, ptr %tmp.upgrd.6 56 %tmp3 = getelementptr %struct.charsequence, ptr %cs, i64 0, i32 2 ; <ptr> [#uses=1] 57 %tmp4 = getelementptr %struct.charsequence, ptr @C.0.2294, i64 0, i32 2 ; <ptr> [#uses=1] 58 %tmp5 = load i32, ptr %tmp4 ; <i32> [#uses=1] 59 store i32 %tmp5, ptr %tmp3 60 br label %bb33 61bb: ; preds = %bb33 62 %tmp.upgrd.8 = load ptr, ptr %f_addr ; <ptr> [#uses=1] 63 %tmp.upgrd.9 = call i32 @_IO_getc( ptr %tmp.upgrd.8 ) ; <i32> [#uses=1] 64 %tmp6 = call i32 @tolower( i32 %tmp.upgrd.9 ) ; <i32> [#uses=1] 65 %tmp6.upgrd.10 = trunc i32 %tmp6 to i8 ; <i8> [#uses=1] 66 store i8 %tmp6.upgrd.10, ptr %c 67 %tmp7 = load i32, ptr %wstate ; <i32> [#uses=1] 68 %tmp.upgrd.11 = icmp ne i32 %tmp7, 0 ; <i1> [#uses=1] 69 br i1 %tmp.upgrd.11, label %cond_true, label %cond_false 70cond_true: ; preds = %bb 71 %tmp.upgrd.12 = load i8, ptr %c ; <i8> [#uses=1] 72 %tmp8 = icmp sle i8 %tmp.upgrd.12, 96 ; <i1> [#uses=1] 73 br i1 %tmp8, label %cond_true9, label %cond_next 74cond_true9: ; preds = %cond_true 75 br label %bb16 76cond_next: ; preds = %cond_true 77 %tmp10 = load i8, ptr %c ; <i8> [#uses=1] 78 %tmp11 = icmp sgt i8 %tmp10, 122 ; <i1> [#uses=1] 79 br i1 %tmp11, label %cond_true12, label %cond_next13 80cond_true12: ; preds = %cond_next 81 br label %bb16 82cond_next13: ; preds = %cond_next 83 %tmp14 = load i8, ptr %c ; <i8> [#uses=1] 84 %tmp14.upgrd.13 = sext i8 %tmp14 to i32 ; <i32> [#uses=1] 85 %tmp1415 = trunc i32 %tmp14.upgrd.13 to i8 ; <i8> [#uses=1] 86 call void @charsequence_push( ptr %cs, i8 %tmp1415 ) 87 br label %bb21 88bb16: ; preds = %cond_true12, %cond_true9 89 %tmp17 = call ptr @charsequence_val( ptr %cs ) ; <ptr> [#uses=1] 90 store ptr %tmp17, ptr %str 91 %tmp.upgrd.14 = load ptr, ptr %t_addr ; <ptr> [#uses=1] 92 %tmp18 = load ptr, ptr %str ; <ptr> [#uses=1] 93 %tmp19 = call ptr @trie_insert( ptr %tmp.upgrd.14, ptr %tmp18 ) ; <ptr> [#uses=0] 94 %tmp20 = load ptr, ptr %str ; <ptr> [#uses=1] 95 call void @free( ptr %tmp20 ) 96 store i32 0, ptr %wstate 97 br label %bb21 98bb21: ; preds = %bb16, %cond_next13 99 br label %cond_next32 100cond_false: ; preds = %bb 101 %tmp22 = load i8, ptr %c ; <i8> [#uses=1] 102 %tmp23 = icmp sgt i8 %tmp22, 96 ; <i1> [#uses=1] 103 br i1 %tmp23, label %cond_true24, label %cond_next31 104cond_true24: ; preds = %cond_false 105 %tmp25 = load i8, ptr %c ; <i8> [#uses=1] 106 %tmp26 = icmp sle i8 %tmp25, 122 ; <i1> [#uses=1] 107 br i1 %tmp26, label %cond_true27, label %cond_next30 108cond_true27: ; preds = %cond_true24 109 call void @charsequence_reset( ptr %cs ) 110 %tmp28 = load i8, ptr %c ; <i8> [#uses=1] 111 %tmp28.upgrd.15 = sext i8 %tmp28 to i32 ; <i32> [#uses=1] 112 %tmp2829 = trunc i32 %tmp28.upgrd.15 to i8 ; <i8> [#uses=1] 113 call void @charsequence_push( ptr %cs, i8 %tmp2829 ) 114 store i32 1, ptr %wstate 115 br label %cond_next30 116cond_next30: ; preds = %cond_true27, %cond_true24 117 br label %cond_next31 118cond_next31: ; preds = %cond_next30, %cond_false 119 br label %cond_next32 120cond_next32: ; preds = %cond_next31, %bb21 121 br label %bb33 122bb33: ; preds = %cond_next32, %entry 123 %tmp34 = load ptr, ptr %f_addr ; <ptr> [#uses=1] 124 %tmp35 = call i32 @feof( ptr %tmp34 ) ; <i32> [#uses=1] 125 %tmp36 = icmp eq i32 %tmp35, 0 ; <i1> [#uses=1] 126 br i1 %tmp36, label %bb, label %bb37 127bb37: ; preds = %bb33 128 br label %return 129return: ; preds = %bb37 130 ret void 131} 132