Alexey Samsonov | b7f02d3 | 2015-06-09 22:10:29 +0000 | [diff] [blame] | 1 | ; Check that LoopSimplify creates debug locations in synthesized basic blocks. |
| 2 | ; RUN: opt -loop-simplify %s -S -o - | FileCheck %s |
| 3 | |
| 4 | %union.anon = type { i32 } |
| 5 | %"Length" = type <{ %union.anon, i8, i8, i8, i8 }> |
| 6 | declare void @bar(%"Length"*) #3 |
| 7 | @catchtypeinfo = external unnamed_addr constant { i8*, i8*, i8* } |
| 8 | declare i32 @__gxx_personality_v0(...) |
| 9 | declare void @f1() |
| 10 | declare void @f2() |
| 11 | declare void @f3() |
| 12 | |
| 13 | ; CHECK-LABEL: @foo |
| 14 | ; CHECK: for.body.preheader: |
| 15 | ; CHECK-NEXT: br label %for.body, !dbg [[PREHEADER_LOC:![0-9]+]] |
| 16 | ; CHECK: for.end.loopexit: |
| 17 | ; CHECK-NEXT: br label %for.end, !dbg [[LOOPEXIT_LOC:![0-9]+]] |
| 18 | |
Peter Collingbourne | d4bff30 | 2015-11-05 22:03:56 +0000 | [diff] [blame^] | 19 | define linkonce_odr hidden void @foo(%"Length"* %begin, %"Length"* %end) nounwind ssp uwtable align 2 !dbg !6 { |
Alexey Samsonov | b7f02d3 | 2015-06-09 22:10:29 +0000 | [diff] [blame] | 20 | entry: |
| 21 | %cmp.4 = icmp eq %"Length"* %begin, %end, !dbg !7 |
| 22 | br i1 %cmp.4, label %for.end, label %for.body, !dbg !8 |
| 23 | |
| 24 | for.body: ; preds = %entry, %length.exit |
| 25 | %begin.sink5 = phi %"Length"* [ %incdec.ptr, %length.exit ], [ %begin, %entry ] |
| 26 | %m_type.i.i.i = getelementptr inbounds %"Length", %"Length"* %begin.sink5, i64 0, i32 2, !dbg !9 |
| 27 | %0 = load i8, i8* %m_type.i.i.i, align 1, !dbg !9 |
| 28 | %cmp.i.i = icmp eq i8 %0, 9, !dbg !7 |
| 29 | br i1 %cmp.i.i, label %if.then.i, label %length.exit, !dbg !8 |
| 30 | |
| 31 | if.then.i: ; preds = %for.body |
| 32 | tail call void @bar(%"Length"* %begin.sink5) #7, !dbg !10 |
| 33 | br label %length.exit, !dbg !10 |
| 34 | |
| 35 | length.exit: ; preds = %for.body, %if.then.i |
| 36 | %incdec.ptr = getelementptr inbounds %"Length", %"Length"* %begin.sink5, i64 1, !dbg !11 |
| 37 | %cmp = icmp eq %"Length"* %incdec.ptr, %end, !dbg !7 |
| 38 | br i1 %cmp, label %for.end, label %for.body, !dbg !8 |
| 39 | |
| 40 | for.end: ; preds = %length.exit, %entry |
| 41 | ret void, !dbg !12 |
| 42 | } |
| 43 | |
| 44 | ; CHECK-LABEL: @with_landingpad |
| 45 | ; CHECK: catch.preheader: |
| 46 | ; CHECK: br label %catch, !dbg [[LPAD_PREHEADER_LOC:![0-9]+]] |
| 47 | ; CHECK: catch.preheader.split-lp: |
| 48 | ; CHECK: br label %catch, !dbg [[LPAD_PREHEADER_LOC]] |
| 49 | |
David Majnemer | 7fddecc | 2015-06-17 20:52:32 +0000 | [diff] [blame] | 50 | define void @with_landingpad() uwtable ssp personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { |
Alexey Samsonov | b7f02d3 | 2015-06-09 22:10:29 +0000 | [diff] [blame] | 51 | entry: |
| 52 | invoke void @f1() to label %try.cont19 unwind label %catch, !dbg !13 |
| 53 | |
| 54 | catch: ; preds = %if.else, %entry |
David Majnemer | 7fddecc | 2015-06-17 20:52:32 +0000 | [diff] [blame] | 55 | %0 = landingpad { i8*, i32 } |
Alexey Samsonov | b7f02d3 | 2015-06-09 22:10:29 +0000 | [diff] [blame] | 56 | catch i8* bitcast ({ i8*, i8*, i8* }* @catchtypeinfo to i8*), !dbg !13 |
| 57 | invoke void @f3() to label %if.else unwind label %eh.resume, !dbg !13 |
| 58 | |
| 59 | if.else: ; preds = %catch |
| 60 | invoke void @f2() to label %try.cont19 unwind label %catch, !dbg !13 |
| 61 | |
| 62 | try.cont19: ; preds = %if.else, %entry |
| 63 | ret void, !dbg !13 |
| 64 | |
| 65 | eh.resume: ; preds = %catch |
David Majnemer | 7fddecc | 2015-06-17 20:52:32 +0000 | [diff] [blame] | 66 | %1 = landingpad { i8*, i32 } |
Alexey Samsonov | b7f02d3 | 2015-06-09 22:10:29 +0000 | [diff] [blame] | 67 | cleanup catch i8* bitcast ({ i8*, i8*, i8* }* @catchtypeinfo to i8*), !dbg !13 |
| 68 | resume { i8*, i32 } undef, !dbg !13 |
| 69 | } |
| 70 | |
| 71 | ; CHECK-DAG: [[PREHEADER_LOC]] = !DILocation(line: 73, column: 27, scope: !{{[0-9]+}}) |
| 72 | ; CHECK-DAG: [[LOOPEXIT_LOC]] = !DILocation(line: 75, column: 9, scope: !{{[0-9]+}}) |
| 73 | ; CHECK-DAG: [[LPAD_PREHEADER_LOC]] = !DILocation(line: 85, column: 1, scope: !{{[0-9]+}}) |
| 74 | |
| 75 | !llvm.module.flags = !{!0, !1, !2} |
| 76 | !0 = !{i32 2, !"Dwarf Version", i32 4} |
| 77 | !1 = !{i32 2, !"Debug Info Version", i32 3} |
| 78 | !2 = !{i32 1, !"PIC Level", i32 2} |
| 79 | |
| 80 | !3 = !{} |
| 81 | !4 = !DISubroutineType(types: !3) |
| 82 | !5 = !DIFile(filename: "Vector.h", directory: "/tmp") |
Peter Collingbourne | d4bff30 | 2015-11-05 22:03:56 +0000 | [diff] [blame^] | 83 | !6 = distinct !DISubprogram(name: "destruct", scope: !5, file: !5, line: 71, type: !4, isLocal: false, isDefinition: true, scopeLine: 72, flags: DIFlagPrototyped, isOptimized: false, variables: !3) |
Alexey Samsonov | b7f02d3 | 2015-06-09 22:10:29 +0000 | [diff] [blame] | 84 | !7 = !DILocation(line: 73, column: 38, scope: !6) |
| 85 | !8 = !DILocation(line: 73, column: 13, scope: !6) |
| 86 | !9 = !DILocation(line: 73, column: 27, scope: !6) |
| 87 | !10 = !DILocation(line: 74, column: 17, scope: !6) |
| 88 | !11 = !DILocation(line: 73, column: 46, scope: !6) |
| 89 | !12 = !DILocation(line: 75, column: 9, scope: !6) |
| 90 | !13 = !DILocation(line: 85, column: 1, scope: !6) |