Owen Anderson | bf91e28 | 2008-06-01 22:26:26 +0000 | [diff] [blame] | 1 | ; RUN: llvm-as < %s | opt -memcpyopt | llvm-dis | grep {call.*memmove.*arg1.*} |
Owen Anderson | 986cb19 | 2008-06-01 21:55:55 +0000 | [diff] [blame] | 2 | ; PR2401 |
| 3 | |
| 4 | target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32" |
| 5 | target triple = "i686-pc-linux-gnu" |
| 6 | %struct.Info = type <{ i32, i32, i8*, i8*, i8*, [32 x i8*], i32, [32 x i32], i32, i32, i32, [32 x i32] }> |
| 7 | %struct.S98 = type <{ [31 x double] }> |
| 8 | %struct._IO_FILE = type <{ i32, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, %struct._IO_marker*, %struct._IO_FILE*, i32, i32, i32, i16, i8, [1 x i8], i8*, i64, i8*, i8*, i8*, i8*, i32, i32, [40 x i8] }> |
| 9 | %struct._IO_marker = type <{ %struct._IO_marker*, %struct._IO_FILE*, i32 }> |
| 10 | %struct.anon = type <{ }> |
| 11 | %union.anon = type { } |
| 12 | @info = common global %struct.Info zeroinitializer, align 4 ; <%struct.Info*> [#uses=13] |
| 13 | @fails = common global i32 0, align 4 ; <i32*> [#uses=37] |
| 14 | @s98 = common global %struct.S98 zeroinitializer, align 4 ; <%struct.S98*> [#uses=2] |
| 15 | @a98 = common global [5 x %struct.S98] zeroinitializer, align 4 ; <[5 x %struct.S98]*> [#uses=5] |
| 16 | @stdout = external global %struct._IO_FILE* ; <%struct._IO_FILE**> [#uses=1] |
| 17 | |
| 18 | declare void @llvm.memmove.i32(i8*, i8*, i32, i32) nounwind |
| 19 | |
| 20 | define void @test98() nounwind { |
| 21 | entry: |
| 22 | %arg = alloca %struct.S98, align 8 ; <%struct.S98*> [#uses=2] |
| 23 | %tmp13 = alloca %struct.S98 ; <%struct.S98*> [#uses=2] |
| 24 | %tmp14 = alloca %struct.S98 ; <%struct.S98*> [#uses=2] |
| 25 | %tmp15 = alloca %struct.S98 ; <%struct.S98*> [#uses=2] |
| 26 | %tmp17 = alloca %struct.S98 ; <%struct.S98*> [#uses=2] |
| 27 | %tmp21 = alloca %struct.S98 ; <%struct.S98*> [#uses=0] |
| 28 | %tmp23 = alloca %struct.S98 ; <%struct.S98*> [#uses=0] |
| 29 | %tmp25 = alloca %struct.S98 ; <%struct.S98*> [#uses=0] |
| 30 | %tmp27 = alloca %struct.S98 ; <%struct.S98*> [#uses=0] |
| 31 | %tmp29 = alloca %struct.S98 ; <%struct.S98*> [#uses=0] |
| 32 | %tmp31 = alloca %struct.S98 ; <%struct.S98*> [#uses=0] |
| 33 | %tmp33 = alloca %struct.S98 ; <%struct.S98*> [#uses=0] |
| 34 | call void @llvm.memset.i32( i8* bitcast (%struct.S98* @s98 to i8*), i8 0, i32 248, i32 4 ) |
| 35 | call void @llvm.memset.i32( i8* bitcast ([5 x %struct.S98]* @a98 to i8*), i8 0, i32 1240, i32 4 ) |
| 36 | call void @llvm.memset.i32( i8* bitcast (%struct.Info* @info to i8*), i8 0, i32 420, i32 4 ) |
| 37 | store i8* bitcast (%struct.S98* @s98 to i8*), i8** getelementptr (%struct.Info* @info, i32 0, i32 2) |
| 38 | store i8* bitcast ([5 x %struct.S98]* @a98 to i8*), i8** getelementptr (%struct.Info* @info, i32 0, i32 3) |
| 39 | store i8* bitcast (%struct.S98* getelementptr ([5 x %struct.S98]* @a98, i32 0, i32 3) to i8*), i8** getelementptr (%struct.Info* @info, i32 0, i32 4) |
| 40 | store i32 248, i32* getelementptr (%struct.Info* @info, i32 0, i32 6) |
| 41 | store i32 4, i32* getelementptr (%struct.Info* @info, i32 0, i32 8) |
| 42 | store i32 4, i32* getelementptr (%struct.Info* @info, i32 0, i32 9) |
| 43 | store i32 4, i32* getelementptr (%struct.Info* @info, i32 0, i32 10) |
| 44 | %tmp = load i32* getelementptr (%struct.Info* @info, i32 0, i32 8) ; <i32> [#uses=1] |
| 45 | %sub = add i32 %tmp, -1 ; <i32> [#uses=1] |
| 46 | %and = and i32 %sub, ptrtoint (%struct.S98* getelementptr ([5 x %struct.S98]* @a98, i32 0, i32 3) to i32) ; <i32> [#uses=1] |
| 47 | %tobool = icmp eq i32 %and, 0 ; <i1> [#uses=1] |
| 48 | br i1 %tobool, label %ifend, label %ifthen |
| 49 | |
| 50 | ifthen: ; preds = %entry |
| 51 | %tmp3 = load i32* @fails ; <i32> [#uses=1] |
| 52 | %inc = add i32 %tmp3, 1 ; <i32> [#uses=1] |
| 53 | store i32 %inc, i32* @fails |
| 54 | br label %ifend |
| 55 | |
| 56 | ifend: ; preds = %ifthen, %entry |
| 57 | store i8* bitcast (double* getelementptr (%struct.S98* @s98, i32 0, i32 0, i32 18) to i8*), i8** getelementptr (%struct.Info* @info, i32 0, i32 5, i32 0) |
| 58 | store i32 8, i32* getelementptr (%struct.Info* @info, i32 0, i32 7, i32 0) |
| 59 | store i32 4, i32* getelementptr (%struct.Info* @info, i32 0, i32 11, i32 0) |
| 60 | store double 0xC1075E4620000000, double* getelementptr (%struct.S98* @s98, i32 0, i32 0, i32 18) |
| 61 | store double 0x410CD219E0000000, double* getelementptr ([5 x %struct.S98]* @a98, i32 0, i32 2, i32 0, i32 18) |
| 62 | store i32 1, i32* getelementptr (%struct.Info* @info, i32 0, i32 0) |
| 63 | store i32 0, i32* getelementptr (%struct.Info* @info, i32 0, i32 1) |
| 64 | %tmp16 = bitcast %struct.S98* %tmp15 to i8* ; <i8*> [#uses=1] |
| 65 | call void @llvm.memmove.i32( i8* %tmp16, i8* bitcast (%struct.S98* @s98 to i8*), i32 248, i32 4 ) |
| 66 | %tmp18 = bitcast %struct.S98* %tmp17 to i8* ; <i8*> [#uses=1] |
| 67 | call void @llvm.memmove.i32( i8* %tmp18, i8* bitcast (%struct.S98* getelementptr ([5 x %struct.S98]* @a98, i32 0, i32 2) to i8*), i32 248, i32 4 ) |
| 68 | call void @check98( %struct.S98* sret %tmp14, %struct.S98* byval %tmp15, %struct.S98* getelementptr ([5 x %struct.S98]* @a98, i32 0, i32 1), %struct.S98* byval %tmp17 ) |
| 69 | %tmp19 = bitcast %struct.S98* %tmp13 to i8* ; <i8*> [#uses=1] |
| 70 | %tmp20 = bitcast %struct.S98* %tmp14 to i8* ; <i8*> [#uses=1] |
| 71 | call void @llvm.memmove.i32( i8* %tmp19, i8* %tmp20, i32 248, i32 8 ) |
| 72 | %tmp1 = bitcast %struct.S98* %arg to i8* ; <i8*> [#uses=1] |
| 73 | %tmp2 = bitcast %struct.S98* %tmp13 to i8* ; <i8*> [#uses=1] |
| 74 | call void @llvm.memcpy.i64( i8* %tmp1, i8* %tmp2, i64 248, i32 8 ) |
| 75 | %arrayidx.i = getelementptr %struct.S98* %arg, i32 0, i32 0, i32 18 ; <double*> [#uses=1] |
| 76 | %tmp1.i = load double* %arrayidx.i, align 8 ; <double> [#uses=1] |
| 77 | %tmp2.i = load double* getelementptr (%struct.S98* @s98, i32 0, i32 0, i32 18) ; <double> [#uses=1] |
| 78 | %cmp.i = fcmp une double %tmp1.i, %tmp2.i ; <i1> [#uses=1] |
| 79 | br i1 %cmp.i, label %ifthen.i, label %checkx98.exit |
| 80 | |
| 81 | ifthen.i: ; preds = %ifend |
| 82 | %tmp3.i = load i32* @fails ; <i32> [#uses=1] |
| 83 | %inc.i = add i32 %tmp3.i, 1 ; <i32> [#uses=1] |
| 84 | store i32 %inc.i, i32* @fails |
| 85 | br label %checkx98.exit |
| 86 | |
| 87 | checkx98.exit: ; preds = %ifthen.i, %ifend |
| 88 | ret void |
| 89 | } |
| 90 | |
| 91 | declare void @check98(%struct.S98* sret %agg.result, %struct.S98* byval %arg0, %struct.S98* %arg1, %struct.S98* byval %arg2) nounwind |
| 92 | |
| 93 | declare void @llvm.va_start(i8*) nounwind |
| 94 | |
| 95 | declare void @llvm.va_end(i8*) nounwind |
| 96 | |
| 97 | declare i32 @main() noreturn |
| 98 | |
| 99 | declare i32 @fflush(%struct._IO_FILE*) |
| 100 | |
| 101 | declare void @abort() noreturn nounwind |
| 102 | |
| 103 | declare void @exit(i32) noreturn nounwind |
| 104 | |
| 105 | declare void @llvm.memset.i32(i8*, i8, i32, i32) nounwind |
| 106 | |
| 107 | declare void @llvm.memcpy.i64(i8*, i8*, i64, i32) nounwind |