This is an archive of the discontinued LLVM Phabricator instance.

[memprof] Add scripts to automate testdata regeneration.
ClosedPublic

Authored by snehasish on Mar 8 2023, 8:04 PM.

Details

Summary

The memprof profiles and binaries need to be updated in case of version
updates. This change adds three scripts for llvm-profdata, clang and
llvm tests where memprof profiles are used as inputs. Also update the
tests, profiles and binaries in this change. Change based on the review
suggestions in D145023.

Diff Detail

Event Timeline

snehasish created this revision.Mar 8 2023, 8:04 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 8 2023, 8:04 PM
Herald added a subscriber: wenlei. · View Herald Transcript
snehasish requested review of this revision.Mar 8 2023, 8:04 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMar 8 2023, 8:04 PM
snehasish updated this revision to Diff 503850.Mar 9 2023, 10:49 AM

Update the script for Transforms/PGOProfile/memprof.ll.

snehasish added inline comments.Mar 9 2023, 10:53 AM
llvm/test/Transforms/PGOProfile/Inputs/update_memprof_inputs.sh
64

@tejohnson Turns out the LLVM IR matching issue was due to a difference in the code from which the IR was generated. The one in the comments has a line offset of 30 from main to the callsite of recurse whereas the memprof.ll IR expects a line offset of 31. Perhaps a comment or blank line was omitted? I added a blank line here and added a comment in the update script too.

Generally lgtm, but why did the raw profiles change size from what is currently committed?

llvm/test/Transforms/PGOProfile/Inputs/update_memprof_inputs.sh
64

Hmm, yeah its definitely possible that when the code got copied in a blank line was inadvertently cut.

llvm/test/tools/llvm-profdata/Inputs/update_memprof_inputs.sh
15

Maybe name these more clearly, like BASIC instead of SRC1, etc?

snehasish updated this revision to Diff 503859.Mar 9 2023, 11:23 AM

Update the script in test/tool/llvm-profdata/Inputs.

snehasish marked an inline comment as done.Mar 9 2023, 11:38 AM

Generally lgtm, but why did the raw profiles change size from what is currently committed?

The reduction in size of the raw profiles is due to D145528 where we moved the initialization flags. The older raw profiles include e.g. 4 entries for the basic test case including calls to malloc from Symbolizer::LateInitialize. These two entries were pruned by the filtering logic in RawMemProfReader but contribute to the original raw file size. After D145528 we only have two entries in the generated raw profile. Verified by making a local change to disable filtering and ran llvm-profdata show --memory on the older profiles.

This revision is now accepted and ready to land.Mar 9 2023, 11:42 AM

I'll go ahead and push this. @dblaikie Let me know if you have any comments and I'll follow up separately. Thanks!

This revision was landed with ongoing or failed builds.Mar 9 2023, 11:54 AM
This revision was automatically updated to reflect the committed changes.