This is an archive of the discontinued LLVM Phabricator instance.

[SIFoldOperands] Small code cleanups, NFC.
ClosedPublic

Authored by Pierre-vh on Nov 7 2022, 3:38 AM.

Details

Summary

I've been trying to understand the backend better and decided to read the code of this pass.
While doing so, I noticed parts that could be refactored to be a tiny bit clearer.
I tried to keep the changes minimal, a non-exhaustive list of changes is:

  • Stylistic changes to better fit LLVM's coding style
  • Removing dead/useless functions (e.g. FoldCandidate had getters, but it's a public struct!)
    • Saving regs/opcodes in variables if they're going to be used multiple times in the same condition

Diff Detail

Event Timeline

Pierre-vh created this revision.Nov 7 2022, 3:38 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 7 2022, 3:38 AM
Pierre-vh requested review of this revision.Nov 7 2022, 3:38 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 7 2022, 3:38 AM
foad accepted this revision.Nov 7 2022, 5:50 AM

Looks fine, just some nits inline.

llvm/lib/Target/AMDGPU/SIFoldOperands.cpp
191

Move this down one line?

691

I think the rule is to keep the braces if the body is more than one physical line, even if it's a single logical line.

1009

Probably does not deserve to be a doxygen (three-slash) comment now.

This revision is now accepted and ready to land.Nov 7 2022, 5:50 AM
arsenm accepted this revision.Nov 7 2022, 9:29 AM
This revision was automatically updated to reflect the committed changes.
Pierre-vh marked 3 inline comments as done.