This is an archive of the discontinued LLVM Phabricator instance.

[Metarenamer] Distinguish instructions by opcodes
ClosedPublic

Authored by mkazantsev on Mar 12 2023, 11:08 PM.

Details

Summary

This should improve readability of metarenamed code.

Diff Detail

Event Timeline

mkazantsev created this revision.Mar 12 2023, 11:08 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 12 2023, 11:08 PM
mkazantsev requested review of this revision.Mar 12 2023, 11:08 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 12 2023, 11:08 PM
nikic added a subscriber: nikic.Mar 13 2023, 1:12 AM
nikic added inline comments.
llvm/lib/Transforms/Utils/MetaRenamer.cpp
119

What do you think about using I.getOpcodeName() in general here?

this deserves a test

mkazantsev added inline comments.Mar 14 2023, 4:16 AM
llvm/lib/Transforms/Utils/MetaRenamer.cpp
119

Interesting idea.

this deserves a test

Ok, will add.

mkazantsev planned changes to this revision.Mar 14 2023, 4:36 AM
mkazantsev retitled this revision from [Metarenamer] Distinguish phis and other instructions to [Metarenamer] Distinguish instruction by opcodes.
mkazantsev edited the summary of this revision. (Show Details)

Distinguished all instructions as Nikita has proposed, added test.

mkazantsev retitled this revision from [Metarenamer] Distinguish instruction by opcodes to [Metarenamer] Distinguish instructions by opcodes.Mar 14 2023, 10:38 PM
nikic accepted this revision.Mar 15 2023, 1:31 AM

LGTM

llvm/test/Transforms/MetaRenamer/opcodes.ll
16 ↗(On Diff #505360)

In the future, we might want to special-case some of these to more typical shorter names, e.g. getelementptr -> gep.

This revision is now accepted and ready to land.Mar 15 2023, 1:31 AM
mkazantsev added inline comments.Mar 15 2023, 11:21 PM
llvm/test/Transforms/MetaRenamer/opcodes.ll
16 ↗(On Diff #505360)

I was also thinking about block differentiantion basing on their role, e.g. entry, header, preheader etc. But let's move in small steps.

This revision was automatically updated to reflect the committed changes.