This is an archive of the discontinued LLVM Phabricator instance.

[MetaRenamer] Add command line options to disable renaming specified prefixes
ClosedPublic

Authored by dmakogon on Dec 8 2021, 12:19 AM.

Details

Summary

This patch adds 4 options for specifying functions, aliases, globals and structs name prefixes
that don't need to be renamed by MetaRenamer pass.
This is useful if one has some downstream logic that depends directly on an entity name.
MetaRenamer can break this logic, but with the patch you can tell it not to rename certain names.

Diff Detail

Event Timeline

dmakogon created this revision.Dec 8 2021, 12:19 AM
dmakogon requested review of this revision.Dec 8 2021, 12:19 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 8 2021, 12:19 AM
nikic accepted this revision.Dec 9 2021, 12:20 AM

LG. I don't have any particular familiarity with this pass, but the addition looks reasonable and this is an internal debugging pass anyway. (Also TIL, I've made good use of it already after seeing this patch!)

llvm/lib/Transforms/Utils/MetaRenamer.cpp
41

I think these options should be called rename-exclude-function-prefixes (without the s on function etc).

llvm/test/Transforms/MetaRenamer/exclude-names.ll
2

I'd suggest adding some symbols that can be renamed to this test as well, to check that it's only affecting prefixes.

This revision is now accepted and ready to land.Dec 9 2021, 12:20 AM
lkail added a subscriber: lkail.Dec 9 2021, 12:37 AM