brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.9 KiB · 98bdd74 Raw
65 lines · plain
1; RUN: mkdir -p %t && cd %t2; RUN: opt < %s -passes=insert-gcov-profiling -S | FileCheck %s3 4; CHECK:       @__llvm_gcov_ctr = internal global [1 x i64] zeroinitializer5 6;; If an indirectbr critical edge cannot be split, ignore it.7;; The edge will not be profiled.8; CHECK-LABEL: @cannot_split(9; CHECK:       indirect.preheader:10; CHECK-NEXT:    load {{.*}} @__llvm_gcov_ctr11; CHECK-NOT:     load {{.*}} @__llvm_gcov_ctr12 13define dso_local i32 @cannot_split(ptr nocapture readonly %p) !dbg !7 {14entry:15  %targets = alloca <2 x ptr>, align 1616  store <2 x ptr> <ptr blockaddress(@cannot_split, %indirect), ptr blockaddress(@cannot_split, %end)>, ptr %targets, align 16, !dbg !917  br label %for.cond, !dbg !1418 19for.cond:                                         ; preds = %for.cond, %entry20  %p.addr.0 = phi ptr [ %p, %entry ], [ %incdec.ptr, %for.cond ]21  %0 = load i8, ptr %p.addr.0, align 1, !dbg !1522  %cmp = icmp eq i8 %0, 7, !dbg !1723  %incdec.ptr = getelementptr inbounds i8, ptr %p.addr.0, i64 1, !dbg !1824  br i1 %cmp, label %indirect.preheader, label %for.cond, !dbg !15, !llvm.loop !1925 26indirect.preheader:                               ; preds = %for.cond27  %1 = load i8, ptr %incdec.ptr, align 1, !dbg !2128  %idxprom = sext i8 %1 to i64, !dbg !2129  %arrayidx4 = getelementptr inbounds <2 x ptr>, ptr %targets, i64 0, i64 %idxprom, !dbg !2130  %2 = load ptr, ptr %arrayidx4, align 8, !dbg !2131  br label %indirect32 33indirect:                                         ; preds = %indirect.preheader, %indirect34  indirectbr ptr %2, [label %indirect, label %end]35 36indirect2:37  ; For this test we do not want critical edges split. Adding a 2nd `indirectbr`38  ; does the trick.39  indirectbr ptr %2, [label %indirect, label %end]40 41end:                                              ; preds = %indirect42  ret i32 0, !dbg !2243}44 45!llvm.dbg.cu = !{!0}46!llvm.module.flags = !{!3, !4, !5}47 48!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 12.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !2, splitDebugInlining: false, nameTableKind: None)49!1 = !DIFile(filename: "a.c", directory: "/tmp/c")50!2 = !{}51!3 = !{i32 7, !"Dwarf Version", i32 4}52!4 = !{i32 2, !"Debug Info Version", i32 3}53!5 = !{i32 1, !"wchar_size", i32 4}54!7 = distinct !DISubprogram(name: "cannot_split", scope: !1, file: !1, line: 1, type: !8, scopeLine: 1, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)55!8 = !DISubroutineType(types: !2)56!9 = !DILocation(line: 3, column: 14, scope: !7)57!14 = !DILocation(line: 5, column: 3, scope: !7)58!15 = !DILocation(line: 6, column: 9, scope: !7)59!17 = !DILocation(line: 6, column: 12, scope: !7)60!18 = !DILocation(line: 5, column: 12, scope: !7)61!19 = distinct !{!19, !14, !20}62!20 = !DILocation(line: 9, column: 5, scope: !7)63!21 = !DILocation(line: 0, scope: !7)64!22 = !DILocation(line: 11, column: 3, scope: !7)65