-
Notifications
You must be signed in to change notification settings - Fork 351
APPLE-INTERNAL: Revert INSTR_PROF_*_VERSION to 1400/1316/1300 format #5207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: stable/20220421
Are you sure you want to change the base?
Conversation
|
@swift-ci test |
ed83a83 to
3132ad9
Compare
|
Removed some |
|
@swift-ci test |
|
I'll do my best to read through this today. |
3132ad9 to
36162b7
Compare
|
Revert some memprof-related commits I missed: Hopefully will get the Linux build working. |
|
@swift-ci test |
36162b7 to
c5daf29
Compare
|
One of the necessary cherry-picks (703a0ea) changes the constructor for Partially revert that cherry-pick to use This ought to be equivalent because the current behaviour is to store the filenames twice: once using All of my local testing passed with this change. ( |
|
@swift-ci test |
For more details, read the comments on rdar://84254277. This revert is unfortunately very large. I've squashed everything together to make it easier to see what's going on. This will be the last time we have to do this though. :) To make the coverage format compatible, we need, in InstrProfData.inc: * `INSTR_PROF_RAW_VERSION 5` * `INSTR_PROF_INDEX_VERSION 7` * `INSTR_PROF_COVMAP_VERSION 4` Prior to this revert we have * `INSTR_PROF_RAW_VERSION 8` * `INSTR_PROF_INDEX_VERSION 8` * `INSTR_PROF_COVMAP_VERSION 5` So, this revert includes every commit which directly impacts these values *and* any changes in-between that * Refactor code significantly * Make assumptions about the new format. This might seem like a bit of a sledgehammer. However, say, avoiding reverting NFC refactors would introduce tricky merge conflicts. Fixing those merge conflicts is likely to introduce bugs. Testing: * `ninja check-all` does not exhibit any new failures with this change. * `llvm-profdata show` can handle raw profiles produced by building the LLVM test suite with clang-1316. Output is identical. * `llvm-profdata merge` handles raw profiles produced with the 1316 format on the LLVM test suite with the same output as the 1316 `llvm-profdata`. Conflicts: clang/include/clang/Basic/CodeGenOptions.h clang/include/clang/Driver/Options.td clang/lib/CodeGen/BackendUtil.cpp clang/lib/CodeGen/CoverageMappingGen.cpp clang/lib/Driver/ToolChains/Clang.cpp clang/test/CoverageMapping/abspath.cpp clang/test/Profile/profile-prefix-map.c compiler-rt/include/profile/MemProfData.inc compiler-rt/lib/memprof/memprof_rawprofile.cpp compiler-rt/lib/profile/InstrProfilingInternal.h compiler-rt/lib/profile/InstrProfilingPlatformLinux.c compiler-rt/test/profile/Darwin/instrprof-debug-info-correlate.c compiler-rt/test/profile/Linux/binary-id.c compiler-rt/test/profile/Linux/instrprof-debug-info-correlate.c llvm/docs/CommandGuide/llvm-profdata.rst llvm/include/llvm/ProfileData/Coverage/CoverageMappingReader.h llvm/include/llvm/ProfileData/InstrProfCorrelator.h llvm/include/llvm/ProfileData/MemProf.h llvm/include/llvm/ProfileData/MemProfData.inc llvm/include/llvm/ProfileData/RawMemProfReader.h llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp llvm/lib/ProfileData/InstrProf.cpp llvm/lib/ProfileData/InstrProfCorrelator.cpp llvm/lib/ProfileData/InstrProfReader.cpp llvm/lib/ProfileData/RawMemProfReader.cpp llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp llvm/test/Instrumentation/InstrProfiling/debug-info-correlate-coverage.ll llvm/test/Instrumentation/InstrProfiling/debug-info-correlate.ll llvm/test/Instrumentation/InstrProfiling/profiling.ll llvm/test/tools/llvm-profdata/Inputs/basic.memprofraw llvm/test/tools/llvm-profdata/Inputs/c-general.profraw llvm/test/tools/llvm-profdata/Inputs/multi.memprofraw llvm/test/tools/llvm-profdata/large-binary-id-size.test llvm/test/tools/llvm-profdata/malformed-not-space-for-another-header.test llvm/test/tools/llvm-profdata/malformed-num-counters-zero.test llvm/test/tools/llvm-profdata/malformed-ptr-to-counter-array.test llvm/test/tools/llvm-profdata/memprof-basic.test llvm/test/tools/llvm-profdata/memprof-multi.test llvm/unittests/ProfileData/CoverageMappingTest.cpp llvm/unittests/ProfileData/MemProfTest.cpp compiler-rt/lib/memprof/memprof_allocator.cpp Cherry-picks: * 703a0ea Revert "[Coverage] Store compilation dir separately in coverage mapping" New (non-revert, non-cherry-picked) changes: * Update icall-nocomdat.ll to work with old coverage format * Remove coverage mapping directory from `ScanAndUpdateArgs` * Update profiling.ll for old profiling/coverage format * Regenerate `coverage_prefix_map` test for old coverage format * CoverageFilenamesSectionWriter uses `ArrayRef<std::string>` for compatability with Swift's GenCoverage.cpp. Reverts: * 6dd6a61 [memprof] Deduplicate and outline frame storage in the memprof profile. * 14415a3 "Apply clang-tidy fixes for readability-redundant-smartptr-get in InstrProfReader.cpp (NFC)" * 0ca8ff4 "[llvm-profdata] Unify default cutoffs for detailed summary printing". * 27a4f25 "Reland "[memprof] Store callsite metadata with memprof records."" * f4b7944 "Revert "[memprof] Store callsite metadata with memprof records."" * 0d362c9 "[memprof] Store callsite metadata with memprof records." * 9c35303 "[InstrProf][NFC] Fix warning by removing typecast" * fc97efa "Cleanup includes: ProfileData" * b681799 "[instrprof] Rename the profile kind types to be more descriptive." * 0a41849 "Reland "[memprof] Extend the index prof format to include memory profiles."" * 19bdf44 "Revert "Reland "[memprof] Extend the index prof format to include memory profiles.""" * 807ba7a "Reland "[memprof] Extend the index prof format to include memory profiles."" * a3beb34 "Reland "[InstrProf] Make the IndexedInstrProf header backwards compatible."" * 9fd2cb2 "Revert "[InstrProf] Make the IndexedInstrProf header backwards compatible."" * 85355a5 "Revert "Reland "[memprof] Extend the index prof format to include memory profiles.""" * de54e4a "Reland "[memprof] Extend the index prof format to include memory profiles."" * 34a62f9 "[llvm-profdata] Fix use-after-move" * 0f73fb1 "Revert "[memprof] Extend the index prof format to include memory profiles."" * 43c2348 "[memprof] Extend the index prof format to include memory profiles." * 14cc41a "[InstrProf] Make the IndexedInstrProf header backwards compatible." * 216575e "Revert "Revert "[ProfileData] Read and symbolize raw memprof profiles.""" * dbf47d2 "Revert "[ProfileData] Read and symbolize raw memprof profiles."" * 26f978d "[ProfileData] Read and symbolize raw memprof profiles." * 14f4f63 "[memprof] Print out the summary in YAML format." * d2df8d5 "[instrprof][NFC] Templatize the instrprof iterator." * 7756b34 "[InstrProf][NFC] Remove stray option in InstrProfWriter" * 186dcd4 "[instrprof][NFC] Refactor out the common logic for getProfileKind." * eea002a "[InstrProf][NFC] Move function out of InstrProf.h" * 11d3074 "[InstrProf] Add single byte coverage mode" * 13d8947 "[InstrProf][NFC] Refactor Profile kind into a bitset enum." * c9baa56 "[InstrProf][Correlate] Verify debug info with llvm-profdata show" * 6d52391 "[InstrProf][Correlate] Improve error messages" * f170595 "[InstrProf][Correlator] Do not compress names when reading debug info" * ccb09a4 "Fix broken comment in InstrProfData.inc" * 88d8177 "[InstrProf] Restore InstrProfData.inc to fix Fuchsia builds" * f214737 "[InstrProf][NFC] Do not assume size of counter type" * 4ecf15b "[llvm-profdata] Make -debug-info visible" * ac719d7 "[InstrProf] Don't profile merge by default in lightweight mode" * 65d7fd0 "[Try2][InstrProf] Add Correlator class to read debug info" * bdc68ee "Revert "[InstrProf] Add Correlator class to read debug info"" * 95946d2 "[InstrProf] Add Correlator class to read debug info" * 58d9c1a "[Try2][InstrProf] Attach debug info to counters" * c809da7 "Revert "[InstrProf] Attach debug info to counters"" * 800bf8e "[InstrProf] Attach debug info to counters" * 7cca33b "[memprof] Extend llvm-profdata to display MemProf profile summaries." * 24c615f "[InstrProfData] Bump the raw profile version to 8" * ee88b8d "[compiler-rt] Add more diagnostic to InstrProfError" * 743f78e "[InstrProfiling] Fix warnings when building for Windows" * a1532ed "[InstrProfiling] Make CountersPtr in __profd_ relative" * b9f547e "[llvm][profile] Add padding after binary IDs" * 1df7289 "[compiler-rt/profile] Include __llvm_profile_get_magic in module signature" * 83302c8 "[profile] Fix profile merging with binary IDs" * c579c65 "[compiler-rt][profile] Make corrupted-profile.c more robust" * f984ac2 "[profile] Add binary id into profiles" * f0a616efa42b33cd280d5a45c3c2e3aabe278bb5 "Revert "[llvm-profdata] Fix use-after-move"" * 4578233ce8250c206bb342e85632b1d2969039c5 "Revert "[instrprof][NFC] Templatize the instrprof iterator."" * e8d4a36dc9ea5719c3bea227d3fde15a005f7443 "Revert "[llvm-profdata] Unify default cutoffs for detailed summary printing"" * 440d971 "Work around non-existence of ElfW(type) macro on FreeBSD" * 8306968 "[memprof] Move the meminfo block struct to MemProfData.inc." * a2ce97c "[memprof] Fix unit test build after refactoring shared header." * f89319b "Reland "[memprof] Refactor out the MemInfoBlock into a macro based def.""
c5daf29 to
a2fc322
Compare
|
Seems like I may have mismerged 7cca33b, causing build failures in the checks. Hopefully this is the last of the memprofile things to revert. (I just realized it probably doesn't build by default, which is why I'm not seeing these failures on my end.) |
|
@swift-ci test |
|
53/141 files. I don't know much about these profiling/coverage formats so I'm mostly looking at formal problems, and so far I haven't found any. I think I could have done a better job if the patch was actually split up into commits, so I was able to understand what each change is trying to accomplish. But I don't think this warrants re-doing the patch for me. I also applied the static analyzer before/after and it hasn't found any new issues! (: This whole |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I looked through all the code and questioned all the scary places that I've encountered and I haven't discovered any apparent problems. So I hope it'll all work out one way or another!
For more details, read the comments on rdar://84254277.
This revert is unfortunately very large. I've squashed everything
together to make it easier to see what's going on. This will be the
last time we have to do this though. :)
To make the coverage format compatible, we need, in InstrProfData.inc:
INSTR_PROF_RAW_VERSION 5INSTR_PROF_INDEX_VERSION 7INSTR_PROF_COVMAP_VERSION 4Prior to this revert we have
INSTR_PROF_RAW_VERSION 8INSTR_PROF_INDEX_VERSION 8INSTR_PROF_COVMAP_VERSION 5So, this revert includes every commit which directly impacts these
values and any changes in-between that
This might seem like a bit of a sledgehammer. However, say, avoiding
reverting NFC refactors would introduce tricky merge conflicts. Fixing
those merge conflicts is likely to introduce bugs.
Testing:
ninja check-alldoes not exhibit any new failures with this change.llvm-profdata showcan handle raw profiles produced by building theLLVM test suite with clang-1316. Output is identical.
llvm-profdata mergehandles raw profiles produced with the 1316 formaton the LLVM test suite with the same output as the 1316
llvm-profdata.Conflicts:
clang/include/clang/Basic/CodeGenOptions.h
clang/include/clang/Driver/Options.td
clang/lib/CodeGen/BackendUtil.cpp
clang/lib/CodeGen/CoverageMappingGen.cpp
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/CoverageMapping/abspath.cpp
clang/test/Profile/profile-prefix-map.c
compiler-rt/include/profile/MemProfData.inc
compiler-rt/lib/memprof/memprof_rawprofile.cpp
compiler-rt/lib/profile/InstrProfilingInternal.h
compiler-rt/lib/profile/InstrProfilingPlatformLinux.c
compiler-rt/test/profile/Darwin/instrprof-debug-info-correlate.c
compiler-rt/test/profile/Linux/binary-id.c
compiler-rt/test/profile/Linux/instrprof-debug-info-correlate.c
llvm/docs/CommandGuide/llvm-profdata.rst
llvm/include/llvm/ProfileData/Coverage/CoverageMappingReader.h
llvm/include/llvm/ProfileData/InstrProfCorrelator.h
llvm/include/llvm/ProfileData/MemProf.h
llvm/include/llvm/ProfileData/MemProfData.inc
llvm/include/llvm/ProfileData/RawMemProfReader.h
llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp
llvm/lib/ProfileData/InstrProf.cpp
llvm/lib/ProfileData/InstrProfCorrelator.cpp
llvm/lib/ProfileData/InstrProfReader.cpp
llvm/lib/ProfileData/RawMemProfReader.cpp
llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
llvm/test/Instrumentation/InstrProfiling/debug-info-correlate-coverage.ll
llvm/test/Instrumentation/InstrProfiling/debug-info-correlate.ll
llvm/test/Instrumentation/InstrProfiling/profiling.ll
llvm/test/tools/llvm-profdata/Inputs/basic.memprofraw
llvm/test/tools/llvm-profdata/Inputs/c-general.profraw
llvm/test/tools/llvm-profdata/Inputs/multi.memprofraw
llvm/test/tools/llvm-profdata/large-binary-id-size.test
llvm/test/tools/llvm-profdata/malformed-not-space-for-another-header.test
llvm/test/tools/llvm-profdata/malformed-num-counters-zero.test
llvm/test/tools/llvm-profdata/malformed-ptr-to-counter-array.test
llvm/test/tools/llvm-profdata/memprof-basic.test
llvm/test/tools/llvm-profdata/memprof-multi.test
llvm/unittests/ProfileData/CoverageMappingTest.cpp
llvm/unittests/ProfileData/MemProfTest.cpp
Cherry-picks:
New (non-revert, non-cherry-picked) changes:
ScanAndUpdateArgscoverage_prefix_maptest for old coverage formatReverts: