brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.9 KiB · f76f5d6 Raw
110 lines · plain
1; RUN: opt %s -S -passes=instcombine | FileCheck %s2 3;; Check that instcombine merges the DIAssignID metadata when merging two4;; stores into a successor. Filecheck directives inline.5;;6;; Generated from the following source:7;; int c;8;; void esc(int*);9;; int get();10;; void fun() {11;;   int local;12;;   if (c) {13;;     get();14;;     local = 2;15;;   } else {16;;     local = 2;17;;   }18;;   esc(&local);19;; }20 21; CHECK: if.then:22; CHECK-NEXT: %call = call23; CHECK-NEXT: #dbg_assign(i32 2, ![[LOCAL:[0-9]+]], !DIExpression(), ![[MERGED_ID:[0-9]+]], ptr %local, !DIExpression(),24 25; CHECK: if.else:26; CHECK-NEXT: #dbg_assign(i32 2, ![[LOCAL]], !DIExpression(), ![[MERGED_ID]], ptr %local, !DIExpression(),27 28; CHECK: if.end:29; CHECK-NEXT: store i32 2, ptr %local{{.*}}!DIAssignID ![[MERGED_ID]]30 31; CHECK: ![[LOCAL]] = !DILocalVariable(name: "local",32 33@c = dso_local local_unnamed_addr global i32 0, align 4, !dbg !034 35; Function Attrs: uwtable mustprogress36define dso_local void @_Z3funv() local_unnamed_addr !dbg !11 {37entry:38  %local = alloca i32, align 439  %0 = bitcast ptr %local to ptr, !dbg !1640  call void @llvm.lifetime.start.p0(i64 4, ptr %0), !dbg !1641  %1 = load i32, ptr @c, align 4, !dbg !1742  %tobool = icmp ne i32 %1, 0, !dbg !1743  br i1 %tobool, label %if.then, label %if.else, !dbg !2344 45if.then:                                          ; preds = %entry46  %call = call i32 @_Z3getv(), !dbg !2447  store i32 2, ptr %local, align 4, !dbg !26, !DIAssignID !2748  call void @llvm.dbg.assign(metadata i32 2, metadata !15, metadata !DIExpression(), metadata !27, metadata ptr %local, metadata !DIExpression()), !dbg !2649  br label %if.end, !dbg !2850 51if.else:                                          ; preds = %entry52  store i32 2, ptr %local, align 4, !dbg !29, !DIAssignID !3153  call void @llvm.dbg.assign(metadata i32 2, metadata !15, metadata !DIExpression(), metadata !31, metadata ptr %local, metadata !DIExpression()), !dbg !2954  br label %if.end55 56if.end:                                           ; preds = %if.else, %if.then57  call void @_Z3escPi(ptr %local), !dbg !3258  call void @llvm.lifetime.end.p0(i64 4, ptr %0), !dbg !3359  ret void, !dbg !3360}61 62declare !dbg !34 dso_local i32 @_Z3getv() local_unnamed_addr63declare !dbg !37 dso_local void @_Z3escPi(ptr) local_unnamed_addr64declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture)65declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture)66declare void @llvm.dbg.assign(metadata, metadata, metadata, metadata, metadata, metadata)67 68!llvm.dbg.cu = !{!2}69!llvm.module.flags = !{!7, !8, !9, !1000}70!llvm.ident = !{!10}71 72!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())73!1 = distinct !DIGlobalVariable(name: "c", scope: !2, file: !3, line: 1, type: !6, isLocal: false, isDefinition: true)74!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !3, producer: "clang version 12.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, splitDebugInlining: false, nameTableKind: None)75!3 = !DIFile(filename: "test.cpp", directory: "/")76!4 = !{}77!5 = !{!0}78!6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)79!7 = !{i32 7, !"Dwarf Version", i32 4}80!8 = !{i32 2, !"Debug Info Version", i32 3}81!9 = !{i32 1, !"wchar_size", i32 4}82!10 = !{!"clang version 12.0.0"}83!11 = distinct !DISubprogram(name: "fun", linkageName: "_Z3funv", scope: !3, file: !3, line: 4, type: !12, scopeLine: 4, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !14)84!12 = !DISubroutineType(types: !13)85!13 = !{null}86!14 = !{!15}87!15 = !DILocalVariable(name: "local", scope: !11, file: !3, line: 5, type: !6)88!16 = !DILocation(line: 5, column: 3, scope: !11)89!17 = !DILocation(line: 6, column: 7, scope: !18)90!18 = distinct !DILexicalBlock(scope: !11, file: !3, line: 6, column: 7)91!23 = !DILocation(line: 6, column: 7, scope: !11)92!24 = !DILocation(line: 7, column: 5, scope: !25)93!25 = distinct !DILexicalBlock(scope: !18, file: !3, line: 6, column: 10)94!26 = !DILocation(line: 8, column: 11, scope: !25)95!27 = distinct !DIAssignID()96!28 = !DILocation(line: 9, column: 3, scope: !25)97!29 = !DILocation(line: 10, column: 11, scope: !30)98!30 = distinct !DILexicalBlock(scope: !18, file: !3, line: 9, column: 10)99!31 = distinct !DIAssignID()100!32 = !DILocation(line: 12, column: 3, scope: !11)101!33 = !DILocation(line: 13, column: 1, scope: !11)102!34 = !DISubprogram(name: "get", linkageName: "_Z3getv", scope: !3, file: !3, line: 3, type: !35, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !4)103!35 = !DISubroutineType(types: !36)104!36 = !{!6}105!37 = !DISubprogram(name: "esc", linkageName: "_Z3escPi", scope: !3, file: !3, line: 2, type: !38, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !4)106!38 = !DISubroutineType(types: !39)107!39 = !{null, !40}108!40 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !6, size: 64)109!1000 = !{i32 7, !"debug-info-assignment-tracking", i1 true}110