58 lines · plain
1; RUN: opt < %s -passes=lcssa -S | FileCheck %s2 3; This test ensures that LCSSA does not insert dbg.value intrinsics using4; insertDebugValuesForPHIs() which effectively cause assignments to be5; re-ordered.6; See PR48206 for more information.7 8define dso_local i32 @_Z5lcssab(i1 zeroext %S2) {9entry:10 br label %loop.interior11 12loop.interior: ; preds = %post.if, %entry13 br i1 %S2, label %if.true, label %if.false14 15if.true: ; preds = %loop.interior16 %X1 = add i32 0, 017 br label %post.if18 19if.false: ; preds = %loop.interior20 %X2 = add i32 0, 121 br label %post.if22 23post.if: ; preds = %if.false, %if.true24 %X3 = phi i32 [ %X1, %if.true ], [ %X2, %if.false ], !dbg !2125 call void @llvm.dbg.value(metadata i32 %X3, metadata !9, metadata !DIExpression()), !dbg !2126 %Y1 = add i32 4, %X3, !dbg !2227 call void @llvm.dbg.value(metadata i32 %Y1, metadata !9, metadata !DIExpression()), !dbg !2228 br i1 %S2, label %loop.exit, label %loop.interior, !dbg !2329 30loop.exit: ; preds = %post.if31; CHECK: loop.exit:32; CHECK-NEXT: %X3.lcssa = phi i3233; CHECK-NOT: call void @llvm.dbg.value34 %X4 = add i32 3, %X335 ret i32 %X436}37 38declare void @llvm.dbg.value(metadata, metadata, metadata)39 40!llvm.dbg.cu = !{!0}41!llvm.debugify = !{!3, !4}42!llvm.module.flags = !{!5}43 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: "/")46!2 = !{}47!3 = !{i32 11}48!4 = !{i32 5}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)57 58