1; RUN: llc < %s 2 3source_filename = "test/CodeGen/ARM/2010-06-25-Thumb2ITInvalidIterator.ll" 4target 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" 5target triple = "thumbv7-apple-darwin3.0.0-iphoneos" 6 7@length = common global i32 0, align 4, !dbg !0 8 9; Function Attrs: nounwind optsize 10define void @x0(ptr nocapture %buf, i32 %nbytes) #0 { 11entry: 12 tail call void @llvm.dbg.value(metadata ptr %buf, metadata !8, metadata !14), !dbg !15 13 tail call void @llvm.dbg.value(metadata i32 %nbytes, metadata !16, metadata !14), !dbg !18 14 %tmp = load i32, ptr @length, !dbg !19 15 %cmp = icmp eq i32 %tmp, -1, !dbg !19 16 %cmp.not = xor i1 %cmp, true 17 %cmp3 = icmp ult i32 %tmp, %nbytes, !dbg !19 18 %or.cond = and i1 %cmp.not, %cmp3 19 tail call void @llvm.dbg.value(metadata i32 %tmp, metadata !16, metadata !14), !dbg !19 20 %nbytes.addr.0 = select i1 %or.cond, i32 %tmp, i32 %nbytes 21 tail call void @llvm.dbg.value(metadata i32 0, metadata !21, metadata !14), !dbg !22 22 br label %while.cond, !dbg !23 23 24while.cond: ; preds = %while.body, %entry 25 26 %0 = phi i32 [ 0, %entry ], [ %inc, %while.body ] 27 %buf.addr.0 = getelementptr i8, ptr %buf, i32 %0 28 %cmp7 = icmp ult i32 %0, %nbytes.addr.0, !dbg !23 29 br i1 %cmp7, label %land.rhs, label %while.end, !dbg !23 30 31land.rhs: ; preds = %while.cond 32 %call = tail call i32 @x1() #0, !dbg !23 33 %cmp9 = icmp eq i32 %call, -1, !dbg !23 34 br i1 %cmp9, label %while.end, label %while.body, !dbg !23 35 36while.body: ; preds = %land.rhs 37 %conv = trunc i32 %call to i8, !dbg !24 38 store i8 %conv, ptr %buf.addr.0, !dbg !24 39 %inc = add i32 %0, 1, !dbg !26 40 br label %while.cond, !dbg !27 41 42while.end: ; preds = %land.rhs, %while.cond 43 ret void, !dbg !28 44} 45 46; Function Attrs: optsize 47declare i32 @x1() #1 48 49; Function Attrs: nounwind readnone 50declare void @llvm.dbg.value(metadata, metadata, metadata) #2 51 52attributes #0 = { nounwind optsize } 53attributes #1 = { optsize } 54attributes #2 = { nounwind readnone } 55 56!llvm.dbg.cu = !{!4} 57!llvm.module.flags = !{!6, !7} 58 59!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) 60!1 = !DIGlobalVariable(name: "length", linkageName: "length", scope: !2, file: !2, line: 1, type: !3, isLocal: false, isDefinition: true) 61!2 = !DIFile(filename: "t.c", directory: "/private/tmp") 62!3 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) 63!4 = distinct !DICompileUnit(language: DW_LANG_C99, file: !2, producer: "clang 2.0", isOptimized: true, runtimeVersion: 0, emissionKind: NoDebug, globals: !5) 64!5 = !{!0} 65!6 = !{i32 2, !"Dwarf Version", i32 2} 66!7 = !{i32 2, !"Debug Info Version", i32 3} 67!8 = !DILocalVariable(name: "buf", arg: 1, scope: !9, file: !2, line: 4, type: !12) 68!9 = distinct !DISubprogram(name: "x0", linkageName: "x0", scope: null, file: !2, line: 5, type: !10, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, unit: !4) 69!10 = !DISubroutineType(types: !11) 70!11 = !{null} 71!12 = !DIDerivedType(tag: DW_TAG_pointer_type, scope: !2, file: !2, baseType: !13, size: 32, align: 32) 72!13 = !DIBasicType(name: "unsigned char", size: 8, align: 8, encoding: DW_ATE_unsigned_char) 73!14 = !DIExpression() 74!15 = !DILocation(line: 4, column: 24, scope: !9) 75!16 = !DILocalVariable(name: "nbytes", arg: 2, scope: !9, file: !2, line: 4, type: !17) 76!17 = !DIBasicType(name: "unsigned long", size: 32, align: 32, encoding: DW_ATE_unsigned) 77!18 = !DILocation(line: 4, column: 43, scope: !9) 78!19 = !DILocation(line: 9, column: 2, scope: !20) 79!20 = distinct !DILexicalBlock(scope: !9, file: !2, line: 5, column: 1) 80!21 = !DILocalVariable(name: "nread", scope: !20, file: !2, line: 6, type: !17) 81!22 = !DILocation(line: 10, column: 2, scope: !20) 82!23 = !DILocation(line: 11, column: 2, scope: !20) 83!24 = !DILocation(line: 12, column: 3, scope: !25) 84!25 = distinct !DILexicalBlock(scope: !20, file: !2, line: 11, column: 45) 85!26 = !DILocation(line: 13, column: 3, scope: !25) 86!27 = !DILocation(line: 14, column: 2, scope: !25) 87!28 = !DILocation(line: 15, column: 1, scope: !20) 88 89