1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s 2*9880d681SAndroid Build Coastguard Worker 3*9880d681SAndroid Build Coastguard Workertarget 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*9880d681SAndroid Build Coastguard Workertarget triple = "thumbv7-apple-darwin3.0.0-iphoneos" 5*9880d681SAndroid Build Coastguard Worker 6*9880d681SAndroid Build Coastguard Worker@length = common global i32 0, align 4 ; <i32*> [#uses=1] 7*9880d681SAndroid Build Coastguard Worker 8*9880d681SAndroid Build Coastguard Workerdefine void @x0(i8* nocapture %buf, i32 %nbytes) nounwind optsize { 9*9880d681SAndroid Build Coastguard Workerentry: 10*9880d681SAndroid Build Coastguard Worker tail call void @llvm.dbg.value(metadata i8* %buf, i64 0, metadata !0, metadata !DIExpression()), !dbg !15 11*9880d681SAndroid Build Coastguard Worker tail call void @llvm.dbg.value(metadata i32 %nbytes, i64 0, metadata !8, metadata !DIExpression()), !dbg !16 12*9880d681SAndroid Build Coastguard Worker %tmp = load i32, i32* @length, !dbg !17 ; <i32> [#uses=3] 13*9880d681SAndroid Build Coastguard Worker %cmp = icmp eq i32 %tmp, -1, !dbg !17 ; <i1> [#uses=1] 14*9880d681SAndroid Build Coastguard Worker %cmp.not = xor i1 %cmp, true ; <i1> [#uses=1] 15*9880d681SAndroid Build Coastguard Worker %cmp3 = icmp ult i32 %tmp, %nbytes, !dbg !17 ; <i1> [#uses=1] 16*9880d681SAndroid Build Coastguard Worker %or.cond = and i1 %cmp.not, %cmp3 ; <i1> [#uses=1] 17*9880d681SAndroid Build Coastguard Worker tail call void @llvm.dbg.value(metadata i32 %tmp, i64 0, metadata !8, metadata !DIExpression()), !dbg !17 18*9880d681SAndroid Build Coastguard Worker %nbytes.addr.0 = select i1 %or.cond, i32 %tmp, i32 %nbytes ; <i32> [#uses=1] 19*9880d681SAndroid Build Coastguard Worker tail call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !10, metadata !DIExpression()), !dbg !19 20*9880d681SAndroid Build Coastguard Worker br label %while.cond, !dbg !20 21*9880d681SAndroid Build Coastguard Worker 22*9880d681SAndroid Build Coastguard Workerwhile.cond: ; preds = %while.body, %entry 23*9880d681SAndroid Build Coastguard Worker %0 = phi i32 [ 0, %entry ], [ %inc, %while.body ] ; <i32> [#uses=3] 24*9880d681SAndroid Build Coastguard Worker %buf.addr.0 = getelementptr i8, i8* %buf, i32 %0 ; <i8*> [#uses=1] 25*9880d681SAndroid Build Coastguard Worker %cmp7 = icmp ult i32 %0, %nbytes.addr.0, !dbg !20 ; <i1> [#uses=1] 26*9880d681SAndroid Build Coastguard Worker br i1 %cmp7, label %land.rhs, label %while.end, !dbg !20 27*9880d681SAndroid Build Coastguard Worker 28*9880d681SAndroid Build Coastguard Workerland.rhs: ; preds = %while.cond 29*9880d681SAndroid Build Coastguard Worker %call = tail call i32 @x1() nounwind optsize, !dbg !20 ; <i32> [#uses=2] 30*9880d681SAndroid Build Coastguard Worker %cmp9 = icmp eq i32 %call, -1, !dbg !20 ; <i1> [#uses=1] 31*9880d681SAndroid Build Coastguard Worker br i1 %cmp9, label %while.end, label %while.body, !dbg !20 32*9880d681SAndroid Build Coastguard Worker 33*9880d681SAndroid Build Coastguard Workerwhile.body: ; preds = %land.rhs 34*9880d681SAndroid Build Coastguard Worker %conv = trunc i32 %call to i8, !dbg !21 ; <i8> [#uses=1] 35*9880d681SAndroid Build Coastguard Worker store i8 %conv, i8* %buf.addr.0, !dbg !21 36*9880d681SAndroid Build Coastguard Worker %inc = add i32 %0, 1, !dbg !23 ; <i32> [#uses=1] 37*9880d681SAndroid Build Coastguard Worker br label %while.cond, !dbg !24 38*9880d681SAndroid Build Coastguard Worker 39*9880d681SAndroid Build Coastguard Workerwhile.end: ; preds = %land.rhs, %while.cond 40*9880d681SAndroid Build Coastguard Worker ret void, !dbg !25 41*9880d681SAndroid Build Coastguard Worker} 42*9880d681SAndroid Build Coastguard Worker 43*9880d681SAndroid Build Coastguard Workerdeclare i32 @x1() optsize 44*9880d681SAndroid Build Coastguard Worker 45*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnone 46*9880d681SAndroid Build Coastguard Worker 47*9880d681SAndroid Build Coastguard Worker!llvm.dbg.cu = !{!3} 48*9880d681SAndroid Build Coastguard Worker 49*9880d681SAndroid Build Coastguard Worker!0 = !DILocalVariable(name: "buf", line: 4, arg: 1, scope: !1, file: !2, type: !6) 50*9880d681SAndroid Build Coastguard Worker!1 = distinct !DISubprogram(name: "x0", linkageName: "x0", line: 5, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, unit: !3, file: !26, scope: null, type: !4) 51*9880d681SAndroid Build Coastguard Worker!2 = !DIFile(filename: "t.c", directory: "/private/tmp") 52*9880d681SAndroid Build Coastguard Worker!3 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang 2.0", isOptimized: true, file: !26, globals: !{!14}) 53*9880d681SAndroid Build Coastguard Worker!4 = !DISubroutineType(types: !5) 54*9880d681SAndroid Build Coastguard Worker!5 = !{null} 55*9880d681SAndroid Build Coastguard Worker!6 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 32, align: 32, file: !26, scope: !2, baseType: !7) 56*9880d681SAndroid Build Coastguard Worker!7 = !DIBasicType(tag: DW_TAG_base_type, name: "unsigned char", size: 8, align: 8, encoding: DW_ATE_unsigned_char) 57*9880d681SAndroid Build Coastguard Worker!8 = !DILocalVariable(name: "nbytes", line: 4, arg: 2, scope: !1, file: !2, type: !9) 58*9880d681SAndroid Build Coastguard Worker!9 = !DIBasicType(tag: DW_TAG_base_type, name: "unsigned long", size: 32, align: 32, encoding: DW_ATE_unsigned) 59*9880d681SAndroid Build Coastguard Worker!10 = !DILocalVariable(name: "nread", line: 6, scope: !11, file: !2, type: !9) 60*9880d681SAndroid Build Coastguard Worker!11 = distinct !DILexicalBlock(line: 5, column: 1, file: !26, scope: !1) 61*9880d681SAndroid Build Coastguard Worker!12 = !DILocalVariable(name: "c", line: 7, scope: !11, file: !2, type: !13) 62*9880d681SAndroid Build Coastguard Worker!13 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) 63*9880d681SAndroid Build Coastguard Worker!14 = !DIGlobalVariable(name: "length", linkageName: "length", line: 1, isLocal: false, isDefinition: true, scope: !2, file: !2, type: !13, variable: i32* @length) 64*9880d681SAndroid Build Coastguard Worker!15 = !DILocation(line: 4, column: 24, scope: !1) 65*9880d681SAndroid Build Coastguard Worker!16 = !DILocation(line: 4, column: 43, scope: !1) 66*9880d681SAndroid Build Coastguard Worker!17 = !DILocation(line: 9, column: 2, scope: !11) 67*9880d681SAndroid Build Coastguard Worker!18 = !{i32 0} 68*9880d681SAndroid Build Coastguard Worker!19 = !DILocation(line: 10, column: 2, scope: !11) 69*9880d681SAndroid Build Coastguard Worker!20 = !DILocation(line: 11, column: 2, scope: !11) 70*9880d681SAndroid Build Coastguard Worker!21 = !DILocation(line: 12, column: 3, scope: !22) 71*9880d681SAndroid Build Coastguard Worker!22 = distinct !DILexicalBlock(line: 11, column: 45, file: !26, scope: !11) 72*9880d681SAndroid Build Coastguard Worker!23 = !DILocation(line: 13, column: 3, scope: !22) 73*9880d681SAndroid Build Coastguard Worker!24 = !DILocation(line: 14, column: 2, scope: !22) 74*9880d681SAndroid Build Coastguard Worker!25 = !DILocation(line: 15, column: 1, scope: !11) 75*9880d681SAndroid Build Coastguard Worker!26 = !DIFile(filename: "t.c", directory: "/private/tmp") 76