brintos

brintos / llvm-project-archived public Read only

0
0
Text · 8.2 KiB · e665931 Raw
187 lines · plain
1; RUN: opt -S -passes=jump-threading < %s | FileCheck %s2 3@a = global i32 0, align 44; Test that the llvm.dbg.value calls in a threaded block are correctly updated to5; target the locals in their threaded block, and not the unthreaded one.6define void @test1(i32 %cond1, i32 %cond2) {7; CHECK: [[globalptr:@.*]] = global i32 0, align 48; CHECK: bb.cond2:9; CHECK: #dbg_value(ptr null, ![[DBG1ptr:[0-9]+]], !DIExpression(), ![[DBG2ptr:[0-9]+]]10; CHECK-NEXT: [[TOBOOL1:%.*]] = icmp eq i32 %cond2, 0, !dbg ![[DBGLOCtobool1:[0-9]+]]11; CHECK-NEXT: #dbg_value(!DIArgList(ptr null, i1 [[TOBOOL1]], i1 [[TOBOOL1]]), !{{[0-9]+}}, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_LLVM_arg, 2, DW_OP_plus), !{{[0-9]+}}12; CHECK: bb.cond2.thread:13; CHECK-NEXT: #dbg_value(ptr [[globalptr]], ![[DBG1ptr]], !DIExpression(), ![[DBG2ptr]]14; CHECK-NEXT: [[TOBOOL12:%.*]] = icmp eq i32 %cond2, 0, !dbg ![[DBGLOCtobool1]]15; CHECK-NEXT: #dbg_value(!DIArgList(ptr [[globalptr]], i1 [[TOBOOL12]], i1 [[TOBOOL12]]), !{{[0-9]+}}, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_LLVM_arg, 2, DW_OP_plus), !{{[0-9]+}}16entry:17  %tobool = icmp eq i32 %cond1, 0, !dbg !1518  call void @llvm.dbg.value(metadata i1 %tobool, metadata !9, metadata !DIExpression()), !dbg !1519  br i1 %tobool, label %bb.cond2, label %bb.f1, !dbg !1620 21bb.f1:                                            ; preds = %entry22  call void @f1(), !dbg !1723  br label %bb.cond2, !dbg !1824 25bb.cond2:                                         ; preds = %bb.f1, %entry26  %ptr = phi ptr [ null, %bb.f1 ], [ @a, %entry ], !dbg !1927  call void @llvm.dbg.value(metadata ptr %ptr, metadata !11, metadata !DIExpression()), !dbg !1928  %tobool1 = icmp eq i32 %cond2, 0, !dbg !2029  call void @llvm.dbg.value(metadata !DIArgList(ptr %ptr, i1 %tobool1, i1 %tobool1), metadata !13, metadata !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_LLVM_arg, 2, DW_OP_plus)), !dbg !2030  br i1 %tobool1, label %bb.file, label %bb.f2, !dbg !2131 32bb.f2:                                            ; preds = %bb.cond233  call void @f2(), !dbg !2234  br label %exit, !dbg !2335 36bb.file:                                          ; preds = %bb.cond237  %cmp = icmp eq ptr %ptr, null, !dbg !2438  call void @llvm.dbg.value(metadata i1 %cmp, metadata !14, metadata !DIExpression()), !dbg !2439  br i1 %cmp, label %bb.f4, label %bb.f3, !dbg !2540 41bb.f3:                                            ; preds = %bb.file42  br label %exit, !dbg !2643 44bb.f4:                                            ; preds = %bb.file45  call void @f4(), !dbg !2746  br label %exit, !dbg !2847 48exit:                                             ; preds = %bb.f4, %bb.f3, %bb.f249  ret void, !dbg !2950}51 52; This is testing for debug value intrinsics outside of the threaded block pointing to a value53; inside to correctly take any new definitions.54define void @test2(i32 %cond1, i32 %cond2) !dbg !5 {55; CHECK: bb.f356; CHECK: #dbg_value(ptr @a, !{{[0-9]+}}, !DIExpression(), !{{[0-9]+}}57; CHECK: bb.f458; CHECK-NEXT: [[PTR3:%.*]] = phi ptr [ null, %bb.cond2 ]59; CHECK-NEXT: #dbg_value(ptr [[PTR3]], !{{[0-9]+}}, !DIExpression(), !{{[0-9]+}}60entry:61  %tobool = icmp eq i32 %cond1, 0, !dbg !1562  br i1 %tobool, label %bb.cond2, label %bb.f1, !dbg !1663 64bb.f1:                                            ; preds = %entry65  call void @f1(), !dbg !1766  br label %bb.cond2, !dbg !1867 68bb.cond2:                                         ; preds = %bb.f1, %entry69  %ptr = phi ptr [ null, %bb.f1 ], [ @a, %entry ], !dbg !1970  %tobool1 = icmp eq i32 %cond2, 0, !dbg !2071  br i1 %tobool1, label %bb.file, label %bb.f2, !dbg !2172 73bb.f2:                                            ; preds = %bb.cond274  call void @f2(), !dbg !2275  br label %exit, !dbg !2376 77bb.file:                                          ; preds = %bb.cond278  %cmp = icmp eq ptr %ptr, null, !dbg !2479  call void @llvm.dbg.value(metadata ptr %ptr, metadata !14, metadata !DIExpression()), !dbg !2180  br i1 %cmp, label %bb.f4, label %bb.f3, !dbg !2581 82bb.f3:                                            ; preds = %bb.file83  call void @f3(), !dbg !2684  br label %exit, !dbg !2785 86bb.f4:                                            ; preds = %bb.file87  call void @f4(), !dbg !2888  br label %exit, !dbg !2989 90exit:                                             ; preds = %bb.f4, %bb.f3, %bb.f291  ret void, !dbg !2992}93 94; Test for the cloning of dbg.values on elided instructions -- down one path95; being threaded, the `and` in the function below is optimised away, but its96; debug-info should still be preserved.97; Similarly, the call to f1 gets cloned, its dbg.value should be cloned too.98; Duplicated debug value in land.end.thr_comm is removed by99; RemoveRedundantDbgInstrs pass at the end.100define void @test16(i1 %c, i1 %c2, i1 %c3, i1 %c4) nounwind ssp !dbg !30 {101; CHECK-LABEL: define void @test16(i1102entry:103  %cmp = icmp sgt i32 undef, 1, !dbg !33104  br i1 %c, label %land.end, label %land.rhs, !dbg !33105 106land.rhs:107  br i1 %c2, label %lor.lhs.false.i, label %land.end, !dbg !33108 109lor.lhs.false.i:110  br i1 %c3, label %land.end, label %land.end, !dbg !33111 112; CHECK-LABEL: land.end.thr_comm:113; CHECK-NEXT:  #dbg_value(i32 1,114; CHECK-NEXT:  call void @f1()115; CHECK-NEXT:  br i1 %c4,116 117; CHECK-LABEL: land.end:118; CHECK-NEXT:  %0 = phi i1119; CHECK-NEXT:  #dbg_value(i32 0,120land.end:121  %0 = phi i1 [ true, %entry ], [ false, %land.rhs ], [false, %lor.lhs.false.i], [false, %lor.lhs.false.i]122  call void @llvm.dbg.value(metadata i32 0, metadata !32, metadata !DIExpression()), !dbg !33123  %cmp12 = and i1 %cmp, %0, !dbg !33124  %xor1 = xor i1 %cmp12, %c4, !dbg !33125  call void @llvm.dbg.value(metadata i32 1, metadata !32, metadata !DIExpression()), !dbg !33126  call void @f1()127  br i1 %xor1, label %if.then, label %if.end, !dbg !33128 129if.then:130  ret void, !dbg !33131 132if.end:133  ret void, !dbg !33134}135 136declare void @f1()137 138declare void @f2()139 140declare void @f3()141 142declare void @f4()143 144; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)145declare void @llvm.dbg.value(metadata, metadata, metadata) #0146 147attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }148 149!llvm.dbg.cu = !{!0}150!llvm.debugify = !{!2, !3}151!llvm.module.flags = !{!4}152 153!0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)154!1 = !DIFile(filename: "/home/ben/Documents/llvm-project/llvm/test/Transforms/JumpThreading/thread-debug-info.ll", directory: "/")155!2 = !{i32 15}156!3 = !{i32 4}157!4 = !{i32 2, !"Debug Info Version", i32 3}158!5 = distinct !DISubprogram(name: "test2", linkageName: "test2", scope: null, file: !1, line: 1, type: !6, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !8)159!6 = !DISubroutineType(types: !7)160!7 = !{}161!8 = !{!9, !11, !13, !14}162!9 = !DILocalVariable(name: "1", scope: !5, file: !1, line: 1, type: !10)163!10 = !DIBasicType(name: "ty8", size: 8, encoding: DW_ATE_unsigned)164!11 = !DILocalVariable(name: "2", scope: !5, file: !1, line: 5, type: !12)165!12 = !DIBasicType(name: "ty64", size: 64, encoding: DW_ATE_unsigned)166!13 = !DILocalVariable(name: "3", scope: !5, file: !1, line: 6, type: !10)167!14 = !DILocalVariable(name: "4", scope: !5, file: !1, line: 10, type: !10)168!15 = !DILocation(line: 1, column: 1, scope: !5)169!16 = !DILocation(line: 2, column: 1, scope: !5)170!17 = !DILocation(line: 3, column: 1, scope: !5)171!18 = !DILocation(line: 4, column: 1, scope: !5)172!19 = !DILocation(line: 5, column: 1, scope: !5)173!20 = !DILocation(line: 6, column: 1, scope: !5)174!21 = !DILocation(line: 7, column: 1, scope: !5)175!22 = !DILocation(line: 8, column: 1, scope: !5)176!23 = !DILocation(line: 9, column: 1, scope: !5)177!24 = !DILocation(line: 10, column: 1, scope: !5)178!25 = !DILocation(line: 11, column: 1, scope: !5)179!26 = !DILocation(line: 12, column: 1, scope: !5)180!27 = !DILocation(line: 13, column: 1, scope: !5)181!28 = !DILocation(line: 14, column: 1, scope: !5)182!29 = !DILocation(line: 15, column: 1, scope: !5)183!30 = distinct !DISubprogram(name: "test13", linkageName: "test13", scope: null, file: !1, line: 1, type: !6, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !31)184!31 = !{!32}185!32 = !DILocalVariable(name: "1", scope: !30, file: !1, line: 1, type: !10)186!33 = !DILocation(line: 1, column: 1, scope: !30)187