86 lines · plain
1; RUN: llc < %s | FileCheck %s2;3; The test code is generated from the following source code:4; 5; 1 extern int bar(int x);6; 27; 3 int foo(int *begin, int *end) {8; 4 int *i;9; 5 int ret = 0;10; 6 for (11; 7 i = begin ;12; 8 i != end ;13; 9 i++)14; 10 {15; 11 ret += bar(*i);16; 12 }17; 13 return ret;18; 14 }19; 20; CHECK: # %entry21; CHECK-NOT: # %for.body22; CHECK: .loc 1 6 323; CHECK-NEXT: je [[BB:.LBB[^ ]+]]24; CHECK: [[BB]]:25; CHECK: xorl %ebp, %ebp26; CHECK-NEXT: .LBB{{.*}} # %for.end27 28target triple = "x86_64-unknown-linux-gnu"29 30define i32 @foo(ptr readonly %begin, ptr readnone %end) !dbg !4 {31entry:32 %cmp6 = icmp eq ptr %begin, %end, !dbg !933 br i1 %cmp6, label %for.end, label %for.body.preheader, !dbg !1234 35for.body.preheader: ; preds = %entry36 br label %for.body, !dbg !1337 38for.body: ; preds = %for.body.preheader, %for.body39 %ret.08 = phi i32 [ %add, %for.body ], [ 0, %for.body.preheader ]40 %i.07 = phi ptr [ %incdec.ptr, %for.body ], [ %begin, %for.body.preheader ]41 %0 = load i32, ptr %i.07, align 4, !dbg !13, !tbaa !1542 %call = tail call i32 @bar(i32 %0), !dbg !1943 %add = add nsw i32 %call, %ret.08, !dbg !2044 %incdec.ptr = getelementptr inbounds i32, ptr %i.07, i64 1, !dbg !2145 %cmp = icmp eq ptr %incdec.ptr, %end, !dbg !946 br i1 %cmp, label %for.end.loopexit, label %for.body, !dbg !12, !llvm.loop !2247 48for.end.loopexit: ; preds = %for.body49 br label %for.end, !dbg !2450 51for.end: ; preds = %for.end.loopexit, %entry52 %ret.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.end.loopexit ]53 ret i32 %ret.0.lcssa, !dbg !2454}55 56declare i32 @bar(i32)57 58!llvm.dbg.cu = !{!0}59!llvm.module.flags = !{!2, !3}60 61!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, emissionKind: FullDebug)62!1 = !DIFile(filename: "foo.c", directory: "b/")63!2 = !{i32 2, !"Dwarf Version", i32 4}64!3 = !{i32 2, !"Debug Info Version", i32 3}65!4 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 3, type: !5, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: true, unit: !0)66!5 = !DISubroutineType(types: !6)67!6 = !{!7, !8, !8}68!7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)69!8 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !7, size: 64)70!9 = !DILocation(line: 8, column: 9, scope: !10)71!10 = distinct !DILexicalBlock(scope: !11, file: !1, line: 6, column: 3)72!11 = distinct !DILexicalBlock(scope: !4, file: !1, line: 6, column: 3)73!12 = !DILocation(line: 6, column: 3, scope: !11)74!13 = !DILocation(line: 11, column: 18, scope: !14)75!14 = distinct !DILexicalBlock(scope: !10, file: !1, line: 10, column: 3)76!15 = !{!16, !16, i64 0}77!16 = !{!"int", !17, i64 0}78!17 = !{!"omnipotent char", !18, i64 0}79!18 = !{!"Simple C/C++ TBAA"}80!19 = !DILocation(line: 11, column: 14, scope: !14)81!20 = !DILocation(line: 11, column: 11, scope: !14)82!21 = !DILocation(line: 9, column: 8, scope: !10)83!22 = distinct !{!22, !12, !23}84!23 = !DILocation(line: 12, column: 3, scope: !11)85!24 = !DILocation(line: 13, column: 3, scope: !4)86