1 ; RUN: llc < %s -mtriple=x86_64-apple-darwin10 -disable-fp-elim -relocation-model=pic 2 ; PR4099 3 4 %0 = type { [62 x %struct.Bitvec*] } ; type %0 5 %1 = type { i8* } ; type %1 6 %2 = type { double } ; type %2 7 %struct..5sPragmaType = type { i8*, i32 } 8 %struct.AggInfo = type { i8, i8, i32, %struct.ExprList*, i32, %struct.AggInfo_col*, i32, i32, i32, %struct.AggInfo_func*, i32, i32 } 9 %struct.AggInfo_col = type { %struct.Table*, i32, i32, i32, i32, %struct.Expr* } 10 %struct.AggInfo_func = type { %struct.Expr*, %struct.FuncDef*, i32, i32 } 11 %struct.AuxData = type { i8*, void (i8*)* } 12 %struct.Bitvec = type { i32, i32, i32, %0 } 13 %struct.BtCursor = type { %struct.Btree*, %struct.BtShared*, %struct.BtCursor*, %struct.BtCursor*, i32 (i8*, i32, i8*, i32, i8*)*, i8*, i32, %struct.MemPage*, i32, %struct.CellInfo, i8, i8, i8*, i64, i32, i8, i32* } 14 %struct.BtLock = type { %struct.Btree*, i32, i8, %struct.BtLock* } 15 %struct.BtShared = type { %struct.Pager*, %struct.sqlite3*, %struct.BtCursor*, %struct.MemPage*, i8, i8, i8, i8, i8, i8, i8, i8, i32, i16, i16, i32, i32, i32, i32, i8, i32, i8*, void (i8*)*, %struct.sqlite3_mutex*, %struct.BusyHandler, i32, %struct.BtShared*, %struct.BtLock*, %struct.Btree* } 16 %struct.Btree = type { %struct.sqlite3*, %struct.BtShared*, i8, i8, i8, i32, %struct.Btree*, %struct.Btree* } 17 %struct.BtreeMutexArray = type { i32, [11 x %struct.Btree*] } 18 %struct.BusyHandler = type { i32 (i8*, i32)*, i8*, i32 } 19 %struct.CellInfo = type { i8*, i64, i32, i32, i16, i16, i16, i16 } 20 %struct.CollSeq = type { i8*, i8, i8, i8*, i32 (i8*, i32, i8*, i32, i8*)*, void (i8*)* } 21 %struct.Column = type { i8*, %struct.Expr*, i8*, i8*, i8, i8, i8, i8 } 22 %struct.Context = type { i64, i32, %struct.Fifo } 23 %struct.CountCtx = type { i64 } 24 %struct.Cursor = type { %struct.BtCursor*, i32, i64, i64, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i64, %struct.Btree*, i32, i8*, i64, i8*, %struct.KeyInfo*, i32, i64, %struct.sqlite3_vtab_cursor*, %struct.sqlite3_module*, i32, i32, i32*, i32*, i8* } 25 %struct.Db = type { i8*, %struct.Btree*, i8, i8, i8*, void (i8*)*, %struct.Schema* } 26 %struct.DbPage = type { %struct.Pager*, i32, %struct.DbPage*, %struct.DbPage*, %struct.PagerLruLink, %struct.DbPage*, i8, i8, i8, i8, i8, i16, %struct.DbPage*, %struct.DbPage*, i8* } 27 %struct.Expr = type { i8, i8, i16, %struct.CollSeq*, %struct.Expr*, %struct.Expr*, %struct.ExprList*, %struct..5sPragmaType, %struct..5sPragmaType, i32, i32, %struct.AggInfo*, i32, i32, %struct.Select*, %struct.Table*, i32 } 28 %struct.ExprList = type { i32, i32, i32, %struct.ExprList_item* } 29 %struct.ExprList_item = type { %struct.Expr*, i8*, i8, i8, i8 } 30 %struct.FKey = type { %struct.Table*, %struct.FKey*, i8*, %struct.FKey*, i32, %struct.sColMap*, i8, i8, i8, i8 } 31 %struct.Fifo = type { i32, %struct.FifoPage*, %struct.FifoPage* } 32 %struct.FifoPage = type { i32, i32, i32, %struct.FifoPage*, [1 x i64] } 33 %struct.FuncDef = type { i16, i8, i8, i8, i8*, %struct.FuncDef*, void (%struct.sqlite3_context*, i32, %struct.Mem**)*, void (%struct.sqlite3_context*, i32, %struct.Mem**)*, void (%struct.sqlite3_context*)*, [1 x i8] } 34 %struct.Hash = type { i8, i8, i32, i32, %struct.HashElem*, %struct._ht* } 35 %struct.HashElem = type { %struct.HashElem*, %struct.HashElem*, i8*, i8*, i32 } 36 %struct.IdList = type { %struct..5sPragmaType*, i32, i32 } 37 %struct.Index = type { i8*, i32, i32*, i32*, %struct.Table*, i32, i8, i8, i8*, %struct.Index*, %struct.Schema*, i8*, i8** } 38 %struct.KeyInfo = type { %struct.sqlite3*, i8, i8, i8, i32, i8*, [1 x %struct.CollSeq*] } 39 %struct.Mem = type { %struct.CountCtx, double, %struct.sqlite3*, i8*, i32, i16, i8, i8, void (i8*)* } 40 %struct.MemPage = type { i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i16, i16, i16, i16, i16, i16, [5 x %struct._OvflCell], %struct.BtShared*, i8*, %struct.DbPage*, i32, %struct.MemPage* } 41 %struct.Module = type { %struct.sqlite3_module*, i8*, i8*, void (i8*)* } 42 %struct.Op = type { i8, i8, i8, i8, i32, i32, i32, %1 } 43 %struct.Pager = type { %struct.sqlite3_vfs*, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, %struct.Bitvec*, %struct.Bitvec*, i8*, i8*, i8*, i8*, %struct.sqlite3_file*, %struct.sqlite3_file*, %struct.sqlite3_file*, %struct.BusyHandler*, %struct.PagerLruList, %struct.DbPage*, %struct.DbPage*, %struct.DbPage*, i64, i64, i64, i64, i64, i32, void (%struct.DbPage*, i32)*, void (%struct.DbPage*, i32)*, i32, %struct.DbPage**, i8*, [16 x i8] } 44 %struct.PagerLruLink = type { %struct.DbPage*, %struct.DbPage* } 45 %struct.PagerLruList = type { %struct.DbPage*, %struct.DbPage*, %struct.DbPage* } 46 %struct.Schema = type { i32, %struct.Hash, %struct.Hash, %struct.Hash, %struct.Hash, %struct.Table*, i8, i8, i16, i32, %struct.sqlite3* } 47 %struct.Select = type { %struct.ExprList*, i8, i8, i8, i8, i8, i8, i8, %struct.SrcList*, %struct.Expr*, %struct.ExprList*, %struct.Expr*, %struct.ExprList*, %struct.Select*, %struct.Select*, %struct.Select*, %struct.Expr*, %struct.Expr*, i32, i32, [3 x i32] } 48 %struct.SrcList = type { i16, i16, [1 x %struct.SrcList_item] } 49 %struct.SrcList_item = type { i8*, i8*, i8*, %struct.Table*, %struct.Select*, i8, i8, i32, %struct.Expr*, %struct.IdList*, i64 } 50 %struct.Table = type { i8*, i32, %struct.Column*, i32, %struct.Index*, i32, %struct.Select*, i32, %struct.Trigger*, %struct.FKey*, i8*, %struct.Expr*, i32, i8, i8, i8, i8, i8, i8, i8, %struct.Module*, %struct.sqlite3_vtab*, i32, i8**, %struct.Schema* } 51 %struct.Trigger = type { i8*, i8*, i8, i8, %struct.Expr*, %struct.IdList*, %struct..5sPragmaType, %struct.Schema*, %struct.Schema*, %struct.TriggerStep*, %struct.Trigger* } 52 %struct.TriggerStep = type { i32, i32, %struct.Trigger*, %struct.Select*, %struct..5sPragmaType, %struct.Expr*, %struct.ExprList*, %struct.IdList*, %struct.TriggerStep*, %struct.TriggerStep* } 53 %struct.Vdbe = type { %struct.sqlite3*, %struct.Vdbe*, %struct.Vdbe*, i32, i32, %struct.Op*, i32, i32, i32*, %struct.Mem**, %struct.Mem*, i32, %struct.Cursor**, i32, %struct.Mem*, i8**, i32, i32, i32, %struct.Mem*, i32, i32, %struct.Fifo, i32, i32, %struct.Context*, i32, i32, i32, i32, i32, [25 x i32], i32, i32, i8**, i8*, %struct.Mem*, i8, i8, i8, i8, i8, i8, i32, i64, i32, %struct.BtreeMutexArray, i32, i8*, i32 } 54 %struct.VdbeFunc = type { %struct.FuncDef*, i32, [1 x %struct.AuxData] } 55 %struct._OvflCell = type { i8*, i16 } 56 %struct._ht = type { i32, %struct.HashElem* } 57 %struct.sColMap = type { i32, i8* } 58 %struct.sqlite3 = type { %struct.sqlite3_vfs*, i32, %struct.Db*, i32, i32, i32, i32, i8, i8, i8, i8, i32, %struct.CollSeq*, i64, i64, i32, i32, i32, %struct.sqlite3_mutex*, %struct.sqlite3InitInfo, i32, i8**, %struct.Vdbe*, i32, void (i8*, i8*)*, i8*, void (i8*, i8*, i64)*, i8*, i8*, i32 (i8*)*, i8*, void (i8*)*, i8*, void (i8*, i32, i8*, i8*, i64)*, void (i8*, %struct.sqlite3*, i32, i8*)*, void (i8*, %struct.sqlite3*, i32, i8*)*, i8*, %struct.Mem*, i8*, i8*, %2, i32 (i8*, i32, i8*, i8*, i8*, i8*)*, i8*, i32 (i8*)*, i8*, i32, %struct.Hash, %struct.Table*, %struct.sqlite3_vtab**, i32, %struct.Hash, %struct.Hash, %struct.BusyHandler, i32, [2 x %struct.Db], i8 } 59 %struct.sqlite3InitInfo = type { i32, i32, i8 } 60 %struct.sqlite3_context = type { %struct.FuncDef*, %struct.VdbeFunc*, %struct.Mem, %struct.Mem*, i32, %struct.CollSeq* } 61 %struct.sqlite3_file = type { %struct.sqlite3_io_methods* } 62 %struct.sqlite3_index_constraint = type { i32, i8, i8, i32 } 63 %struct.sqlite3_index_constraint_usage = type { i32, i8 } 64 %struct.sqlite3_index_info = type { i32, %struct.sqlite3_index_constraint*, i32, %struct.sqlite3_index_constraint_usage*, %struct.sqlite3_index_constraint_usage*, i32, i8*, i32, i32, double } 65 %struct.sqlite3_io_methods = type { i32, i32 (%struct.sqlite3_file*)*, i32 (%struct.sqlite3_file*, i8*, i32, i64)*, i32 (%struct.sqlite3_file*, i8*, i32, i64)*, i32 (%struct.sqlite3_file*, i64)*, i32 (%struct.sqlite3_file*, i32)*, i32 (%struct.sqlite3_file*, i64*)*, i32 (%struct.sqlite3_file*, i32)*, i32 (%struct.sqlite3_file*, i32)*, i32 (%struct.sqlite3_file*)*, i32 (%struct.sqlite3_file*, i32, i8*)*, i32 (%struct.sqlite3_file*)*, i32 (%struct.sqlite3_file*)* } 66 %struct.sqlite3_module = type { i32, i32 (%struct.sqlite3*, i8*, i32, i8**, %struct.sqlite3_vtab**, i8**)*, i32 (%struct.sqlite3*, i8*, i32, i8**, %struct.sqlite3_vtab**, i8**)*, i32 (%struct.sqlite3_vtab*, %struct.sqlite3_index_info*)*, i32 (%struct.sqlite3_vtab*)*, i32 (%struct.sqlite3_vtab*)*, i32 (%struct.sqlite3_vtab*, %struct.sqlite3_vtab_cursor**)*, i32 (%struct.sqlite3_vtab_cursor*)*, i32 (%struct.sqlite3_vtab_cursor*, i32, i8*, i32, %struct.Mem**)*, i32 (%struct.sqlite3_vtab_cursor*)*, i32 (%struct.sqlite3_vtab_cursor*)*, i32 (%struct.sqlite3_vtab_cursor*, %struct.sqlite3_context*, i32)*, i32 (%struct.sqlite3_vtab_cursor*, i64*)*, i32 (%struct.sqlite3_vtab*, i32, %struct.Mem**, i64*)*, i32 (%struct.sqlite3_vtab*)*, i32 (%struct.sqlite3_vtab*)*, i32 (%struct.sqlite3_vtab*)*, i32 (%struct.sqlite3_vtab*)*, i32 (%struct.sqlite3_vtab*, i32, i8*, void (%struct.sqlite3_context*, i32, %struct.Mem**)**, i8**)*, i32 (%struct.sqlite3_vtab*, i8*)* } 67 %struct.sqlite3_mutex = type opaque 68 %struct.sqlite3_vfs = type { i32, i32, i32, %struct.sqlite3_vfs*, i8*, i8*, i32 (%struct.sqlite3_vfs*, i8*, %struct.sqlite3_file*, i32, i32*)*, i32 (%struct.sqlite3_vfs*, i8*, i32)*, i32 (%struct.sqlite3_vfs*, i8*, i32)*, i32 (%struct.sqlite3_vfs*, i32, i8*)*, i32 (%struct.sqlite3_vfs*, i8*, i32, i8*)*, i8* (%struct.sqlite3_vfs*, i8*)*, void (%struct.sqlite3_vfs*, i32, i8*)*, i8* (%struct.sqlite3_vfs*, i8*, i8*)*, void (%struct.sqlite3_vfs*, i8*)*, i32 (%struct.sqlite3_vfs*, i32, i8*)*, i32 (%struct.sqlite3_vfs*, i32)*, i32 (%struct.sqlite3_vfs*, double*)* } 69 %struct.sqlite3_vtab = type { %struct.sqlite3_module*, i32, i8* } 70 %struct.sqlite3_vtab_cursor = type { %struct.sqlite3_vtab* } 71 72 define fastcc void @dropCell(%struct.MemPage* nocapture %pPage, i32 %idx, i32 %sz) nounwind ssp { 73 entry: 74 %0 = load i8*, i8** null, align 8 ; <i8*> [#uses=4] 75 %1 = or i32 0, 0 ; <i32> [#uses=1] 76 %2 = icmp slt i32 %sz, 4 ; <i1> [#uses=1] 77 %size_addr.0.i = select i1 %2, i32 4, i32 %sz ; <i32> [#uses=1] 78 br label %bb3.i 79 80 bb3.i: ; preds = %bb3.i, %entry 81 %3 = icmp eq i32 0, 0 ; <i1> [#uses=1] 82 %or.cond.i = or i1 %3, false ; <i1> [#uses=1] 83 br i1 %or.cond.i, label %bb5.i, label %bb3.i 84 85 bb5.i: ; preds = %bb3.i 86 %4 = getelementptr i8, i8* %0, i64 0 ; <i8*> [#uses=1] 87 store i8 0, i8* %4, align 1 88 %5 = getelementptr i8, i8* %0, i64 0 ; <i8*> [#uses=1] 89 store i8 0, i8* %5, align 1 90 %6 = add i32 %1, 2 ; <i32> [#uses=1] 91 %7 = zext i32 %6 to i64 ; <i64> [#uses=2] 92 %8 = getelementptr i8, i8* %0, i64 %7 ; <i8*> [#uses=1] 93 %9 = lshr i32 %size_addr.0.i, 8 ; <i32> [#uses=1] 94 %10 = trunc i32 %9 to i8 ; <i8> [#uses=1] 95 store i8 %10, i8* %8, align 1 96 %.sum31.i = add i64 %7, 1 ; <i64> [#uses=1] 97 %11 = getelementptr i8, i8* %0, i64 %.sum31.i ; <i8*> [#uses=1] 98 store i8 0, i8* %11, align 1 99 br label %bb11.outer.i 100 101 bb11.outer.i: ; preds = %bb11.outer.i, %bb5.i 102 %12 = icmp eq i32 0, 0 ; <i1> [#uses=1] 103 br i1 %12, label %bb12.i, label %bb11.outer.i 104 105 bb12.i: ; preds = %bb11.outer.i 106 %i.08 = add i32 %idx, 1 ; <i32> [#uses=1] 107 %13 = icmp sgt i32 0, %i.08 ; <i1> [#uses=1] 108 br i1 %13, label %bb, label %bb2 109 110 bb: ; preds = %bb12.i 111 br label %bb2 112 113 bb2: ; preds = %bb, %bb12.i 114 %14 = getelementptr %struct.MemPage, %struct.MemPage* %pPage, i64 0, i32 1 ; <i8*> [#uses=1] 115 store i8 1, i8* %14, align 1 116 ret void 117 } 118