1 ; RUN: opt < %s -passes=lcssa -S | FileCheck %s
3 ; This test ensures that LCSSA does not insert dbg.value intrinsics using
4 ; insertDebugValuesForPHIs() which effectively cause assignments to be
6 ; See PR48206 for more information.
8 define dso_local i32 @_Z5lcssab(i1 zeroext %S2) {
10 br label %loop.interior
12 loop.interior: ; preds = %post.if, %entry
13 br i1 %S2, label %if.true, label %if.false
15 if.true: ; preds = %loop.interior
19 if.false: ; preds = %loop.interior
23 post.if: ; preds = %if.false, %if.true
24 %X3 = phi i32 [ %X1, %if.true ], [ %X2, %if.false ], !dbg !21
25 call void @llvm.dbg.value(metadata i32 %X3, metadata !9, metadata !DIExpression()), !dbg !21
26 %Y1 = add i32 4, %X3, !dbg !22
27 call void @llvm.dbg.value(metadata i32 %Y1, metadata !9, metadata !DIExpression()), !dbg !22
28 br i1 %S2, label %loop.exit, label %loop.interior, !dbg !23
30 loop.exit: ; preds = %post.if
32 ; CHECK-NEXT: %X3.lcssa = phi i32
33 ; CHECK-NOT: call void @llvm.dbg.value
38 declare void @llvm.dbg.value(metadata, metadata, metadata)
41 !llvm.debugify = !{!3, !4}
42 !llvm.module.flags = !{!5}
44 !0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify and Author", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
45 !1 = !DIFile(filename: "./testcase.ll", directory: "/")
49 !5 = !{i32 2, !"Debug Info Version", i32 3}
50 !6 = distinct !DISubprogram(name: "_Z5lcssab", linkageName: "_Z5lcssab", scope: null, file: !1, line: 1, type: !7, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !{!9})
51 !7 = !DISubroutineType(types: !2)
52 !9 = !DILocalVariable(name: "var", scope: !6, file: !1, line: 3, type: !10)
53 !10 = !DIBasicType(name: "ty32", size: 32, encoding: DW_ATE_unsigned)
54 !21 = !DILocation(line: 7, column: 1, scope: !6)
55 !22 = !DILocation(line: 8, column: 1, scope: !6)
56 !23 = !DILocation(line: 9, column: 1, scope: !6)