This is an archive of the discontinued LLVM Phabricator instance.

Remove getInstrProf*SectionName helpers as an API cleanup, NFC.
ClosedPublic

Authored by vsk on Apr 14 2017, 3:01 PM.

Details

Summary

This is a version of D32090 [1] that removes all of the getInstrProf*SectionName helper functions. The build failures which D32090 would have addressed were fixed with D32073 [2].

I think we should remove these helper functions because they are hard to maintain and use. E.g we had to introduce more helpers to fix our COFF support. The current scheme doesn't totally succeed at hiding low-level details about the section naming scheme from clients, so I think we should move to a more flexible API. We can clean things up by unifying the various helpers into function which accepts an ObjectFileFormat instead of a mix of llvm::Module and bools.

There is a compiler-rt change not shown here (we have to sync up the copies of InstrProfData.inc). There is also one clang change:

 std::string getCoverageSection(const CodeGenModule &CGM) {
-  return llvm::getInstrProfCoverageSectionName(&CGM.getModule());
+  return llvm::getInstrProfSectionName(
+      llvm::IPSK_covmap,
+      CGM.getContext().getTargetInfo().getTriple().getObjectFormat());
 }

Testing: check-clang, check-profile, check-llvm. I haven't tested this on Windows.

[1] https://reviews.llvm.org/D32090
[InstrProf] Fix Windows cross compilation TODOs to fix failing tests

[2] https://reviews.llvm.org/D32073
[ProfileData] Support cross target binary reading for coverage tool

Diff Detail

Repository
rL LLVM

Event Timeline

vsk created this revision.Apr 14 2017, 3:01 PM
davidxl added inline comments.Apr 14 2017, 4:08 PM
lib/Transforms/Instrumentation/InstrProfiling.cpp
144 ↗(On Diff #95351)

Is there a need to keep these wrappers? Seems good to remove too.

vsk marked an inline comment as done.Apr 14 2017, 4:33 PM
vsk added inline comments.
lib/Transforms/Instrumentation/InstrProfiling.cpp
144 ↗(On Diff #95351)

Good point, no need for these either. They are all used once, except one which is dead.

davidxl accepted this revision.Apr 14 2017, 4:36 PM

lgtm

This revision is now accepted and ready to land.Apr 14 2017, 4:36 PM
vsk updated this revision to Diff 95364.Apr 14 2017, 4:38 PM
vsk marked an inline comment as done.

Remove more helper functions in InstrProfiling.h.

This revision was automatically updated to reflect the committed changes.