75 lines · plain
1; RUN: opt -S -passes="loop(loop-flatten)" < %s | FileCheck %s2 3; Check that LoopFlatten's DoFlattenLoopPair() propagates the debug location of the4; original terminator to the new branch instruction.5 6define i32 @test1(i32 %val, ptr nocapture %A) !dbg !5 {7; CHECK-LABEL: define i32 @test1(8; CHECK-LABEL: for.body3:9; CHECK: br label %for.inc6, !dbg [[DBG22:![0-9]+]]10; CHECK-LABEL: for.inc6:11;12entry:13 br label %for.body, !dbg !814 15for.body: ; preds = %for.inc6, %entry16 %i.018 = phi i32 [ 0, %entry ], [ %inc7, %for.inc6 ], !dbg !917 %mul = mul nuw nsw i32 %i.018, 20, !dbg !1018 br label %for.body3, !dbg !1119 20for.body3: ; preds = %for.body3, %for.body21 %j.017 = phi i32 [ 0, %for.body ], [ %inc, %for.body3 ], !dbg !1222 %add = add nuw nsw i32 %j.017, %mul, !dbg !1323 %arrayidx = getelementptr inbounds i16, ptr %A, i32 %add, !dbg !1424 %0 = load i16, ptr %arrayidx, align 2, !dbg !1525 %conv16 = zext i16 %0 to i32, !dbg !1626 %add4 = add i32 %conv16, %val, !dbg !1727 %conv5 = trunc i32 %add4 to i16, !dbg !1828 store i16 %conv5, ptr %arrayidx, align 2, !dbg !1929 %inc = add nuw nsw i32 %j.017, 1, !dbg !2030 %exitcond = icmp ne i32 %inc, 20, !dbg !2131 br i1 %exitcond, label %for.body3, label %for.inc6, !dbg !2232 33for.inc6: ; preds = %for.body334 %inc7 = add nuw nsw i32 %i.018, 1, !dbg !2335 %exitcond19 = icmp ne i32 %inc7, 10, !dbg !2436 br i1 %exitcond19, label %for.body, label %for.end8, !dbg !2537 38for.end8: ; preds = %for.inc639 ret i32 10, !dbg !2640}41 42!llvm.dbg.cu = !{!0}43!llvm.debugify = !{!2, !3}44!llvm.module.flags = !{!4}45 46; CHECK: [[DBG22]] = !DILocation(line: 15,47 48!0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)49!1 = !DIFile(filename: "temp.ll", directory: "/")50!2 = !{i32 19}51!3 = !{i32 0}52!4 = !{i32 2, !"Debug Info Version", i32 3}53!5 = distinct !DISubprogram(name: "test1", linkageName: "test1", scope: null, file: !1, line: 1, type: !6, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0)54!6 = !DISubroutineType(types: !7)55!7 = !{}56!8 = !DILocation(line: 1, column: 1, scope: !5)57!9 = !DILocation(line: 2, column: 1, scope: !5)58!10 = !DILocation(line: 3, column: 1, scope: !5)59!11 = !DILocation(line: 4, column: 1, scope: !5)60!12 = !DILocation(line: 5, column: 1, scope: !5)61!13 = !DILocation(line: 6, column: 1, scope: !5)62!14 = !DILocation(line: 7, column: 1, scope: !5)63!15 = !DILocation(line: 8, column: 1, scope: !5)64!16 = !DILocation(line: 9, column: 1, scope: !5)65!17 = !DILocation(line: 10, column: 1, scope: !5)66!18 = !DILocation(line: 11, column: 1, scope: !5)67!19 = !DILocation(line: 12, column: 1, scope: !5)68!20 = !DILocation(line: 13, column: 1, scope: !5)69!21 = !DILocation(line: 14, column: 1, scope: !5)70!22 = !DILocation(line: 15, column: 1, scope: !5)71!23 = !DILocation(line: 16, column: 1, scope: !5)72!24 = !DILocation(line: 17, column: 1, scope: !5)73!25 = !DILocation(line: 18, column: 1, scope: !5)74!26 = !DILocation(line: 19, column: 1, scope: !5)75