This is an archive of the discontinued LLVM Phabricator instance.

[mlir][spirv] Clean up SPIRVOps.cpp. NFC.
ClosedPublic

Authored by kuhar on Aug 5 2022, 2:42 PM.

Details

Summary

Resolve almost all clang tidy warnings in this file:

  1. Clean up string constants.
  2. Use consistent argument names across function declarations and definitions. Rename state - > result, which is consistent with the other dialects.
  3. Remove misleading function parameter name comments (argTypes). This did not match the actual function argument (bool enableNameShadowing).
  4. Simplify calls to is_splat.

Diff Detail

Event Timeline

kuhar created this revision.Aug 5 2022, 2:42 PM
Herald added a project: Restricted Project. · View Herald Transcript
kuhar requested review of this revision.Aug 5 2022, 2:42 PM
kuhar updated this revision to Diff 450804.Aug 8 2022, 7:38 AM
kuhar edited the summary of this revision. (Show Details)

Rebased.

antiagainst accepted this revision.Aug 8 2022, 9:38 AM

Cool, thanks for this!

mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp
1031

I actually think result is not the proper naming; state should be better. This is really building up the full state of the op, including operands, results, and attributes. Results is really just part of it. But I understand the consistency concerns here. So this is also fine to me.

This revision is now accepted and ready to land.Aug 8 2022, 9:38 AM
kuhar added inline comments.Aug 9 2022, 7:37 AM
mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp
1031

My main concern here was that the parameter name did not match the argument name. But yes, the type is even called OperationState after all. If that makes sense globally, I think we should rename the argument name in parse and replace it in all dialects.

This revision was automatically updated to reflect the committed changes.