[PATCH] D131592: [SampleProfile] Fix non-determinism in promoteMergeNotInlinedContextSamples()

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 12 10:11:25 PDT 2022


aeubanks added a comment.

I'm having a very hard time reducing the profile since it's over 1GB. I tried extracting only the entries for the relevant functions, then ran into

  error: /home/aeubanks/tmp/1.prof:166: Expected 'NUM[.NUM]: NUM[ mangled_name:NUM]*', found  3: 4734850658227013518:33988

when I deleted the lines that the reader didn't expect, the non-determinism didn't repro anymore.

`llvm-profdata show --function foo --sample --text` doesn't seem to output the profile in the proper text format, just a human readable format

The IR is fairly small:

  define void @_ZN3re216CharClassBuilder13AddRangeFlagsEiiNS_6Regexp10ParseFlagsE(ptr %0, i32 %1, i32 %2) #0 !dbg !8 {                                                                               
    br label %4                                                                                                                                                                                      
                                                                                                                                                                                                     
  4:                                                ; preds = %3                                                                                                                                     
    call void @_ZN3re216CharClassBuilder13AddRangeFlagsEiiNS_6Regexp10ParseFlagsE(ptr null, i32 0, i32 0), !dbg !11                                                                                  
    ret void                                                                                                                                                                                         
  }                                                                                                                                                                                                  
                                                                                                                                                                                                     
  define internal void @_ZN3re2L9AddUGroupEPNS_16CharClassBuilderEPKNS_6UGroupEiNS_6Regexp10ParseFlagsE(ptr %0, ptr %1, i32 %2) #0 !dbg !12 {                                                        
    br label %4                                                                                                                                                                                      
                                                                                                                                                                                                     
  4:                                                ; preds = %3
    call void @_ZN3re216CharClassBuilder13AddRangeFlagsEiiNS_6Regexp10ParseFlagsE(ptr null, i32 0, i32 0), !dbg !13
    br label %5
  
  5:                                                ; preds = %4
    call void @_ZN3re2L9AddUGroupEPNS_16CharClassBuilderEPKNS_6UGroupEiNS_6Regexp10ParseFlagsE(ptr null, ptr null, i32 0), !dbg !14
    ret void
  }
  
  define ptr @_ZN3re26Regexp5ParseENSt3__u17basic_string_viewIcNS1_11char_traitsIcEEEENS0_10ParseFlagsEPNS_12RegexpStatusE() #0 !dbg !15 {
    br label %1
  
  1:                                                ; preds = %0
    call void @_ZN3re2L9AddUGroupEPNS_16CharClassBuilderEPKNS_6UGroupEiNS_6Regexp10ParseFlagsE(ptr null, ptr null, i32 0), !dbg !16
    ret ptr null
  }
  
  attributes #0 = { "use-sample-profile" }
  
  !llvm.dbg.cu = !{!0}
  !llvm.module.flags = !{!2}
  
  !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: NoDebug, splitDebugInlining: false, debugInfoForProfiling: true, nameTableKind: None)
  !1 = !DIFile(filename: "third_party/re2/parse.cc", directory: "")
  !2 = !{i32 2, !"Debug Info Version", i32 3}
  !8 = distinct !DISubprogram(name: "AddRangeFlags", linkageName: "_ZN3re216CharClassBuilder13AddRangeFlagsEiiNS_6Regexp10ParseFlagsE", scope: !1, file: !1, line: 1602, type: !9, scopeLine: 1603, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !10)
  !9 = !DISubroutineType(types: !10)
  !10 = !{}
  !11 = !DILocation(line: 1610, column: 7, scope: !8)
  !12 = distinct !DISubprogram(name: "AddUGroup", linkageName: "_ZN3re2L9AddUGroupEPNS_16CharClassBuilderEPKNS_6UGroupEiNS_6Regexp10ParseFlagsE", scope: !1, file: !1, line: 1658, type: !9, scopeLine: 1659, flags: DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !10)
  !13 = !DILocation(line: 1662, column: 11, scope: !12)
  !14 = !DILocation(line: 1675, column: 7, scope: !12)
  !15 = distinct !DISubprogram(name: "Parse", linkageName: "_ZN3re26Regexp5ParseENSt3__u17basic_string_viewIcNS1_11char_traitsIcEEEENS0_10ParseFlagsEPNS_12RegexpStatusE", scope: !1, file: !1, line: 2217, type: !9, scopeLine: 2218, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !10)
  !16 = !DILocation(line: 2461, column: 11, scope: !17)
  !17 = !DILexicalBlockFile(scope: !15, file: !1, discriminator: 2)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131592/new/

https://reviews.llvm.org/D131592



More information about the llvm-commits mailing list