brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.9 KiB · 93ed43c Raw
76 lines · plain
1; RUN: opt -S -passes=licm %s | FileCheck %s2;3; LICM should null out debug locations when it hoists instructions out of a loop.4;5; Generated with6; clang -O0 -S -emit-llvm test.cpp -g -gline-tables-only -o t.ll7; opt -S -sroa -passes=adce,simplifycfg -reassociate -domtree -loops \8;     -loop-simplify -passes=lcssa -aa -scalar-evolution -passes=loop-rotate t.ll > test.ll9;10; void bar(int *);11; void foo(int k, int p)12; {13;    for (int i = 0; i < k; i++) {14;      bar(&p + 4);15;    }16; }17;18; We make sure that the instruction that is hoisted into the preheader19; does not have a debug location.20; CHECK: for.body.lr.ph:21; CHECK: getelementptr{{.*}}%p.addr, i64 4{{$}}22; CHECK: for.body:23;24; ModuleID = 't.ll'25source_filename = "test.c"26 27; Function Attrs: nounwind sspstrong uwtable28define void @foo(i32 %k, i32 %p) !dbg !7 {29entry:30  %p.addr = alloca i32, align 431  store i32 %p, ptr %p.addr, align 432  %cmp2 = icmp slt i32 0, %k, !dbg !933  br i1 %cmp2, label %for.body.lr.ph, label %for.end, !dbg !934 35for.body.lr.ph:                                   ; preds = %entry36  br label %for.body, !dbg !937 38for.body:                                         ; preds = %for.body.lr.ph, %for.body39  %i.03 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.body ]40  %add.ptr = getelementptr inbounds i32, ptr %p.addr, i64 4, !dbg !1141  call void @bar(ptr %add.ptr), !dbg !1142  %inc = add nsw i32 %i.03, 1, !dbg !1243  %cmp = icmp slt i32 %inc, %k, !dbg !944  br i1 %cmp, label %for.body, label %for.cond.for.end_crit_edge, !dbg !9, !llvm.loop !1445 46for.cond.for.end_crit_edge:                       ; preds = %for.body47  br label %for.end, !dbg !948 49for.end:                                          ; preds = %for.cond.for.end_crit_edge, %entry50  ret void, !dbg !1651}52 53declare void @bar(ptr)54 55!llvm.dbg.cu = !{!0}56!llvm.module.flags = !{!3, !4, !5}57!llvm.ident = !{!6}58 59!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.9.1 (PS4 clang version 4.50.0.249 7e7cd823 checking)", isOptimized: false, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !2)60!1 = !DIFile(filename: "test.c", directory: "D:\test")61!2 = !{}62!3 = !{i32 2, !"Dwarf Version", i32 4}63!4 = !{i32 2, !"Debug Info Version", i32 3}64!5 = !{i32 1, !"PIC Level", i32 2}65!6 = !{!"clang version 3.9.1 (PS4 clang version 4.50.0.249 7e7cd823 checking)"}66!7 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 2, type: !8, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)67!8 = !DISubroutineType(types: !2)68!9 = !DILocation(line: 4, scope: !10)69!10 = !DILexicalBlockFile(scope: !7, file: !1, discriminator: 1)70!11 = !DILocation(line: 5, scope: !7)71!12 = !DILocation(line: 4, scope: !13)72!13 = !DILexicalBlockFile(scope: !7, file: !1, discriminator: 2)73!14 = distinct !{!14, !15}74!15 = !DILocation(line: 4, scope: !7)75!16 = !DILocation(line: 7, scope: !7)76