65 lines · plain
1; RUN: opt < %s -passes=constraint-elimination -S | FileCheck %s2 3; Check that checkAndReplaceCondition() salvages the debug value information after replacing4; the conditions (`%t.1` in this test) with the speculated constants (GitHub Issue #135736).5; In particular, debug uses are replaced if the debug record is dominated by the condition fact.6 7define i1 @test_and_ule(i4 %x, i4 %y, i4 %z) !dbg !5 {8; CHECK-LABEL: define i1 @test_and_ule(9; CHECK-SAME: i4 [[X:%.*]], i4 [[Y:%.*]], i4 [[Z:%.*]])10; CHECK: [[T_1:%.*]] = icmp ule i4 [[X]], [[Z]], !dbg [[DBG13:![0-9]+]]11;12entry:13 %c.1 = icmp ule i4 %x, %y, !dbg !1114 %c.2 = icmp ule i4 %y, %z, !dbg !1215 %t.1 = icmp ule i4 %x, %z, !dbg !1316 %and = and i1 %c.1, %c.2, !dbg !1417 br i1 %and, label %then, label %exit, !dbg !1518 19; CHECK: [[THEN:.*]]:20; CHECK-NEXT: #dbg_value(i1 true, [[META9:![0-9]+]], !DIExpression(), [[DBG13]])21; CHECK-NEXT: [[R_1:%.*]] = xor i1 true, true, !dbg [[DBG16:![0-9]+]]22then: ; preds = %entry23 #dbg_value(i1 %t.1, !9, !DIExpression(), !13)24 %r.1 = xor i1 %t.1, %t.1, !dbg !1625 br label %exit26 27; CHECK: [[EXIT:.*]]:28; CHECK-NEXT: #dbg_value(i1 [[T_1]], [[META17:![0-9]+]], !DIExpression(), [[DBG13]])29; CHECK-NEXT: ret i1 [[T_1]], !dbg [[DBG18:![0-9]+]]30exit: ; preds = %bb1, %entry31 #dbg_value(i1 %t.1, !17, !DIExpression(), !13)32 ret i1 %t.1, !dbg !1833}34 35!llvm.dbg.cu = !{!0}36!llvm.debugify = !{!2, !3}37!llvm.module.flags = !{!4}38 39!0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)40!1 = !DIFile(filename: "temp.ll", directory: "/")41!2 = !{i32 20}42!3 = !{i32 17}43!4 = !{i32 2, !"Debug Info Version", i32 3}44!5 = distinct !DISubprogram(name: "test_and_ule", linkageName: "test_and_ule", scope: null, file: !1, line: 1, type: !6, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !8)45!6 = !DISubroutineType(types: !7)46!7 = !{}47!8 = !{!9}48!9 = !DILocalVariable(name: "4", scope: !5, file: !1, line: 5, type: !10)49!10 = !DIBasicType(name: "ty8", size: 8, encoding: DW_ATE_unsigned)50!11 = !DILocation(line: 1, column: 1, scope: !5)51!12 = !DILocation(line: 2, column: 1, scope: !5)52!13 = !DILocation(line: 5, column: 1, scope: !5)53!14 = !DILocation(line: 3, column: 1, scope: !5)54!15 = !DILocation(line: 4, column: 1, scope: !5)55!16 = !DILocation(line: 7, column: 1, scope: !5)56!17 = !DILocalVariable(name: "6", scope: !5, file: !1, line: 7, type: !10)57!18 = !DILocation(line: 20, column: 1, scope: !5)58 59; CHECK: [[META9]] = !DILocalVariable(name: "4",60; CHECK: [[DBG13]] = !DILocation(line: 5, column: 1,61; CHECK: [[DBG16]] = !DILocation(line: 7, column: 1,62; CHECK: [[META17]] = !DILocalVariable(name: "6",63; CHECK: [[DBG18]] = !DILocation(line: 20, column: 1,64;.65