| Daniel Dunbar | acbdf53 | 2010-06-25 23:14:54 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s |
| 2 | |
| 3 | target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:64:64-v128:128:128-a0:0:32-n32" |
| 4 | target triple = "thumbv7-apple-darwin3.0.0-iphoneos" |
| 5 | |
| 6 | @length = common global i32 0, align 4 ; <i32*> [#uses=1] |
| 7 | |
| 8 | define void @x0(i8* nocapture %buf, i32 %nbytes) nounwind optsize { |
| 9 | entry: |
| Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 10 | tail call void @llvm.dbg.value(metadata i8* %buf, i64 0, metadata !0, metadata !{!"0x102"}), !dbg !15 |
| 11 | tail call void @llvm.dbg.value(metadata i32 %nbytes, i64 0, metadata !8, metadata !{!"0x102"}), !dbg !16 |
| Daniel Dunbar | acbdf53 | 2010-06-25 23:14:54 +0000 | [diff] [blame] | 12 | %tmp = load i32* @length, !dbg !17 ; <i32> [#uses=3] |
| 13 | %cmp = icmp eq i32 %tmp, -1, !dbg !17 ; <i1> [#uses=1] |
| 14 | %cmp.not = xor i1 %cmp, true ; <i1> [#uses=1] |
| 15 | %cmp3 = icmp ult i32 %tmp, %nbytes, !dbg !17 ; <i1> [#uses=1] |
| 16 | %or.cond = and i1 %cmp.not, %cmp3 ; <i1> [#uses=1] |
| Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 17 | tail call void @llvm.dbg.value(metadata i32 %tmp, i64 0, metadata !8, metadata !{!"0x102"}), !dbg !17 |
| Daniel Dunbar | acbdf53 | 2010-06-25 23:14:54 +0000 | [diff] [blame] | 18 | %nbytes.addr.0 = select i1 %or.cond, i32 %tmp, i32 %nbytes ; <i32> [#uses=1] |
| Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 19 | tail call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !10, metadata !{!"0x102"}), !dbg !19 |
| Daniel Dunbar | acbdf53 | 2010-06-25 23:14:54 +0000 | [diff] [blame] | 20 | br label %while.cond, !dbg !20 |
| 21 | |
| 22 | while.cond: ; preds = %while.body, %entry |
| 23 | %0 = phi i32 [ 0, %entry ], [ %inc, %while.body ] ; <i32> [#uses=3] |
| David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame^] | 24 | %buf.addr.0 = getelementptr i8, i8* %buf, i32 %0 ; <i8*> [#uses=1] |
| Daniel Dunbar | acbdf53 | 2010-06-25 23:14:54 +0000 | [diff] [blame] | 25 | %cmp7 = icmp ult i32 %0, %nbytes.addr.0, !dbg !20 ; <i1> [#uses=1] |
| 26 | br i1 %cmp7, label %land.rhs, label %while.end, !dbg !20 |
| 27 | |
| 28 | land.rhs: ; preds = %while.cond |
| 29 | %call = tail call i32 @x1() nounwind optsize, !dbg !20 ; <i32> [#uses=2] |
| 30 | %cmp9 = icmp eq i32 %call, -1, !dbg !20 ; <i1> [#uses=1] |
| 31 | br i1 %cmp9, label %while.end, label %while.body, !dbg !20 |
| 32 | |
| 33 | while.body: ; preds = %land.rhs |
| 34 | %conv = trunc i32 %call to i8, !dbg !21 ; <i8> [#uses=1] |
| 35 | store i8 %conv, i8* %buf.addr.0, !dbg !21 |
| 36 | %inc = add i32 %0, 1, !dbg !23 ; <i32> [#uses=1] |
| 37 | br label %while.cond, !dbg !24 |
| 38 | |
| 39 | while.end: ; preds = %land.rhs, %while.cond |
| 40 | ret void, !dbg !25 |
| 41 | } |
| 42 | |
| 43 | declare i32 @x1() optsize |
| 44 | |
| Adrian Prantl | 87b7eb9 | 2014-10-01 18:55:02 +0000 | [diff] [blame] | 45 | declare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnone |
| Daniel Dunbar | acbdf53 | 2010-06-25 23:14:54 +0000 | [diff] [blame] | 46 | |
| 47 | !llvm.dbg.lv.fn = !{!0, !8, !10, !12} |
| 48 | !llvm.dbg.gv = !{!14} |
| 49 | |
| Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 50 | !0 = !{!"0x101\00buf\004\000", !1, !2, !6} ; [ DW_TAG_arg_variable ] |
| 51 | !1 = !{!"0x2e\00x0\00x0\00x0\005\000\001\000\006\000\000\000", !26, null, !4, null, null, null, null, null} ; [ DW_TAG_subprogram ] |
| 52 | !2 = !{!"0x29", !26} ; [ DW_TAG_file_type ] |
| 53 | !3 = !{!"0x11\0012\00clang 2.0\001\00\00\00\00", !26, null, null, null, null, null} ; [ DW_TAG_compile_unit ] |
| 54 | !4 = !{!"0x15\00\000\000\000\000\000\000", !26, !2, null, !5, null} ; [ DW_TAG_subroutine_type ] |
| 55 | !5 = !{null} |
| 56 | !6 = !{!"0xf\00\000\0032\0032\000\000", !26, !2, !7} ; [ DW_TAG_pointer_type ] |
| 57 | !7 = !{!"0x24\00unsigned char\000\008\008\000\000\008", !26, !2} ; [ DW_TAG_base_type ] |
| 58 | !8 = !{!"0x101\00nbytes\004\000", !1, !2, !9} ; [ DW_TAG_arg_variable ] |
| 59 | !9 = !{!"0x24\00unsigned long\000\0032\0032\000\000\007", !26, !2} ; [ DW_TAG_base_type ] |
| 60 | !10 = !{!"0x100\00nread\006\000", !11, !2, !9} ; [ DW_TAG_auto_variable ] |
| 61 | !11 = !{!"0xb\005\001\000", !26, !1} ; [ DW_TAG_lexical_block ] |
| 62 | !12 = !{!"0x100\00c\007\000", !11, !2, !13} ; [ DW_TAG_auto_variable ] |
| 63 | !13 = !{!"0x24\00int\000\0032\0032\000\000\005", !26, !2} ; [ DW_TAG_base_type ] |
| 64 | !14 = !{!"0x34\00length\00length\00length\001\000\001", !2, !2, !13, i32* @length} ; [ DW_TAG_variable ] |
| Duncan P. N. Exon Smith | 9885469 | 2015-01-14 22:27:36 +0000 | [diff] [blame] | 65 | !15 = !MDLocation(line: 4, column: 24, scope: !1) |
| 66 | !16 = !MDLocation(line: 4, column: 43, scope: !1) |
| 67 | !17 = !MDLocation(line: 9, column: 2, scope: !11) |
| Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 68 | !18 = !{i32 0} |
| Duncan P. N. Exon Smith | 9885469 | 2015-01-14 22:27:36 +0000 | [diff] [blame] | 69 | !19 = !MDLocation(line: 10, column: 2, scope: !11) |
| 70 | !20 = !MDLocation(line: 11, column: 2, scope: !11) |
| 71 | !21 = !MDLocation(line: 12, column: 3, scope: !22) |
| Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 72 | !22 = !{!"0xb\0011\0045\000", !26, !11} ; [ DW_TAG_lexical_block ] |
| Duncan P. N. Exon Smith | 9885469 | 2015-01-14 22:27:36 +0000 | [diff] [blame] | 73 | !23 = !MDLocation(line: 13, column: 3, scope: !22) |
| 74 | !24 = !MDLocation(line: 14, column: 2, scope: !22) |
| 75 | !25 = !MDLocation(line: 15, column: 1, scope: !11) |
| Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 76 | !26 = !{!"t.c", !"/private/tmp"} |