brintos

brintos / llvm-project-archived public Read only

0
0
Text · 9.0 KiB · aa2cd18 Raw
191 lines · plain
1; RUN: llc -start-after=codegenprepare -stop-before finalize-isel -o - %s \2; RUN:    -experimental-debug-variable-locations=false \3; RUN: | FileCheck %s --check-prefixes=CHECK,DBGVALUE4; RUN: llc -start-after=codegenprepare -stop-before finalize-isel -o - %s \5; RUN:    -experimental-debug-variable-locations=true \6; RUN: | FileCheck %s --check-prefixes=CHECK,INSTRREF7 8; This test case was generated from the following debug.c program,9; using: clang debug.c -g -O1 -S -o dbg_value_phi_isel1.ll -emit-llvm10; --------------------------------------11; int end = 10;12;13; int main() {14;   int x = 9;15;   int y = 13;16;   for (int u = 0; u < end; ++u) {17;     x += y;18;     y = y * 3;19;   }20;21;   volatile int arr[80];22;   for (int q = 0; q < 64; ++q) {23;     arr[q] = q + 3;24;   }25;26;   return x;27; }28; --------------------------------------29;30 31; ModuleID = 'debug.c'32source_filename = "debug.c"33target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"34target triple = "x86_64-unknown-linux-gnu"35 36@end = dso_local local_unnamed_addr global i32 10, align 4, !dbg !037 38; Function Attrs: nounwind uwtable39define dso_local i32 @main() local_unnamed_addr #0 !dbg !11 {40; CHECK-LABEL: name:            main41entry:42  %arr = alloca [80 x i32], align 1643  call void @llvm.dbg.value(metadata i32 9, metadata !15, metadata !DIExpression()), !dbg !2644  call void @llvm.dbg.value(metadata i32 13, metadata !16, metadata !DIExpression()), !dbg !2745  call void @llvm.dbg.value(metadata i32 0, metadata !17, metadata !DIExpression()), !dbg !2846  %0 = load i32, ptr @end, align 4, !dbg !29, !tbaa !3147  %cmp20 = icmp sgt i32 %0, 0, !dbg !3548  br i1 %cmp20, label %for.body.lr.ph, label %for.cond.cleanup, !dbg !3649 50for.body.lr.ph:                                   ; preds = %entry51  %1 = load i32, ptr @end, align 4, !tbaa !3152  br label %for.body, !dbg !3653 54for.cond.cleanup:                                 ; preds = %for.body, %entry55; CHECK-LABEL: bb.{{.*}}.for.cond.cleanup:56; CHECK:         [[REG1:%[0-9]+]]:gr32 = PHI57; INSTRREF-SAME:    debug-instr-number 758; INSTRREF-NEXT: DBG_INSTR_REF {{.+}}, dbg-instr-ref(7, 0)59; DBGVALUE-NEXT: DBG_VALUE [[REG1]]60  %x.0.lcssa = phi i32 [ 9, %entry ], [ %add, %for.body ]61  call void @llvm.dbg.value(metadata i32 %x.0.lcssa, metadata !15, metadata !DIExpression()), !dbg !2662  call void @llvm.lifetime.start.p0(i64 320, ptr nonnull %arr) #3, !dbg !3763  call void @llvm.dbg.declare(metadata ptr %arr, metadata !19, metadata !DIExpression()), !dbg !3864  call void @llvm.dbg.value(metadata i32 0, metadata !24, metadata !DIExpression()), !dbg !3965  br label %for.body4, !dbg !4066 67for.body:                                         ; preds = %for.body.lr.ph, %for.body68; CHECK-LABEL: bb.{{.*}}.for.body:69; CHECK:        [[REG2:%[0-9]+]]:gr32 = PHI70; INSTRREF-SAME:   debug-instr-number 371; CHECK-NEXT:   [[REG3:%[0-9]+]]:gr32 = PHI72; INSTRREF-SAME:   debug-instr-number 473; CHECK-NEXT:   [[REG4:%[0-9]+]]:gr32 = PHI74; INSTRREF-SAME:   debug-instr-number 575; INSTRREF-NEXT: DBG_INSTR_REF {{.+}}, dbg-instr-ref(3, 0)76; INSTRREF-NEXT: DBG_INSTR_REF {{.+}}, dbg-instr-ref(4, 0)77; INSTRREF-NEXT: DBG_INSTR_REF {{.+}}, dbg-instr-ref(5, 0)78; DBGVALUE-NEXT: DBG_VALUE [[REG2]]79; DBGVALUE-NEXT: DBG_VALUE [[REG3]]80; DBGVALUE-NEXT: DBG_VALUE [[REG4]]81  %u.023 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.body ]82  %y.022 = phi i32 [ 13, %for.body.lr.ph ], [ %mul, %for.body ]83  %x.021 = phi i32 [ 9, %for.body.lr.ph ], [ %add, %for.body ]84  call void @llvm.dbg.value(metadata i32 %u.023, metadata !17, metadata !DIExpression()), !dbg !2885  call void @llvm.dbg.value(metadata i32 %y.022, metadata !16, metadata !DIExpression()), !dbg !2786  call void @llvm.dbg.value(metadata i32 %x.021, metadata !15, metadata !DIExpression()), !dbg !2687  %add = add nuw nsw i32 %y.022, %x.021, !dbg !4188  %mul = mul nsw i32 %y.022, 3, !dbg !4389  %inc = add nuw nsw i32 %u.023, 1, !dbg !4490  call void @llvm.dbg.value(metadata i32 %inc, metadata !17, metadata !DIExpression()), !dbg !2891  call void @llvm.dbg.value(metadata i32 %mul, metadata !16, metadata !DIExpression()), !dbg !2792  call void @llvm.dbg.value(metadata i32 %add, metadata !15, metadata !DIExpression()), !dbg !2693  %cmp = icmp slt i32 %inc, %1, !dbg !3594  br i1 %cmp, label %for.body, label %for.cond.cleanup, !dbg !36, !llvm.loop !4595 96for.cond.cleanup3:                                ; preds = %for.body497  call void @llvm.lifetime.end.p0(i64 320, ptr nonnull %arr) #3, !dbg !4798  ret i32 %x.0.lcssa, !dbg !4899 100for.body4:                                        ; preds = %for.body4, %for.cond.cleanup101  %indvars.iv = phi i64 [ 0, %for.cond.cleanup ], [ %indvars.iv.next, %for.body4 ]102  call void @llvm.dbg.value(metadata i64 %indvars.iv, metadata !24, metadata !DIExpression()), !dbg !39103  %arrayidx = getelementptr inbounds [80 x i32], ptr %arr, i64 0, i64 %indvars.iv, !dbg !49104  %2 = trunc i64 %indvars.iv to i32, !dbg !52105  %3 = add i32 %2, 3, !dbg !52106  store volatile i32 %3, ptr %arrayidx, align 4, !dbg !52, !tbaa !31107  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1, !dbg !53108  call void @llvm.dbg.value(metadata i32 undef, metadata !24, metadata !DIExpression(DW_OP_plus_uconst, 1, DW_OP_stack_value)), !dbg !39109  %exitcond = icmp eq i64 %indvars.iv.next, 64, !dbg !54110  br i1 %exitcond, label %for.cond.cleanup3, label %for.body4, !dbg !40, !llvm.loop !55111}112 113; Function Attrs: argmemonly nounwind114declare void @llvm.lifetime.start.p0(i64, ptr nocapture) #1115 116; Function Attrs: nounwind readnone speculatable117declare void @llvm.dbg.declare(metadata, metadata, metadata) #2118 119; Function Attrs: argmemonly nounwind120declare void @llvm.lifetime.end.p0(i64, ptr nocapture) #1121 122; Function Attrs: nounwind readnone speculatable123declare void @llvm.dbg.value(metadata, metadata, metadata) #2124 125attributes #0 = { nounwind uwtable }126attributes #1 = { argmemonly nounwind }127attributes #2 = { nounwind readnone speculatable }128attributes #3 = { nounwind }129 130!llvm.dbg.cu = !{!2}131!llvm.module.flags = !{!7, !8, !9}132!llvm.ident = !{!10}133 134!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())135!1 = distinct !DIGlobalVariable(name: "end", scope: !2, file: !3, line: 1, type: !6, isLocal: false, isDefinition: true)136!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 7.0.0 (x)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5)137!3 = !DIFile(filename: "debug.c", directory: "")138!4 = !{}139!5 = !{!0}140!6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)141!7 = !{i32 2, !"Dwarf Version", i32 4}142!8 = !{i32 2, !"Debug Info Version", i32 3}143!9 = !{i32 1, !"wchar_size", i32 4}144!10 = !{!"clang version 7.0.0 (x)"}145!11 = distinct !DISubprogram(name: "main", scope: !3, file: !3, line: 3, type: !12, isLocal: false, isDefinition: true, scopeLine: 3, isOptimized: true, unit: !2, retainedNodes: !14)146!12 = !DISubroutineType(types: !13)147!13 = !{!6}148!14 = !{!15, !16, !17, !19, !24}149!15 = !DILocalVariable(name: "x", scope: !11, file: !3, line: 4, type: !6)150!16 = !DILocalVariable(name: "y", scope: !11, file: !3, line: 5, type: !6)151!17 = !DILocalVariable(name: "u", scope: !18, file: !3, line: 6, type: !6)152!18 = distinct !DILexicalBlock(scope: !11, file: !3, line: 6, column: 3)153!19 = !DILocalVariable(name: "arr", scope: !11, file: !3, line: 11, type: !20)154!20 = !DICompositeType(tag: DW_TAG_array_type, baseType: !21, size: 2560, elements: !22)155!21 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !6)156!22 = !{!23}157!23 = !DISubrange(count: 80)158!24 = !DILocalVariable(name: "q", scope: !25, file: !3, line: 12, type: !6)159!25 = distinct !DILexicalBlock(scope: !11, file: !3, line: 12, column: 3)160!26 = !DILocation(line: 4, column: 7, scope: !11)161!27 = !DILocation(line: 5, column: 7, scope: !11)162!28 = !DILocation(line: 6, column: 12, scope: !18)163!29 = !DILocation(line: 6, column: 23, scope: !30)164!30 = distinct !DILexicalBlock(scope: !18, file: !3, line: 6, column: 3)165!31 = !{!32, !32, i64 0}166!32 = !{!"int", !33, i64 0}167!33 = !{!"omnipotent char", !34, i64 0}168!34 = !{!"Simple C/C++ TBAA"}169!35 = !DILocation(line: 6, column: 21, scope: !30)170!36 = !DILocation(line: 6, column: 3, scope: !18)171!37 = !DILocation(line: 11, column: 3, scope: !11)172!38 = !DILocation(line: 11, column: 16, scope: !11)173!39 = !DILocation(line: 12, column: 12, scope: !25)174!40 = !DILocation(line: 12, column: 3, scope: !25)175!41 = !DILocation(line: 7, column: 7, scope: !42)176!42 = distinct !DILexicalBlock(scope: !30, file: !3, line: 6, column: 33)177!43 = !DILocation(line: 8, column: 11, scope: !42)178!44 = !DILocation(line: 6, column: 28, scope: !30)179!45 = distinct !{!45, !36, !46}180!46 = !DILocation(line: 9, column: 3, scope: !18)181!47 = !DILocation(line: 17, column: 1, scope: !11)182!48 = !DILocation(line: 16, column: 3, scope: !11)183!49 = !DILocation(line: 13, column: 5, scope: !50)184!50 = distinct !DILexicalBlock(scope: !51, file: !3, line: 12, column: 32)185!51 = distinct !DILexicalBlock(scope: !25, file: !3, line: 12, column: 3)186!52 = !DILocation(line: 13, column: 12, scope: !50)187!53 = !DILocation(line: 12, column: 27, scope: !51)188!54 = !DILocation(line: 12, column: 21, scope: !51)189!55 = distinct !{!55, !40, !56}190!56 = !DILocation(line: 14, column: 3, scope: !25)191