Page MenuHomePhabricator

[mlir] Use std::size instead of llvm::array_lengthof
ClosedPublic

Authored by jloser on Sep 6 2022, 5:03 PM.

Details

Summary

LLVM contains a helpful function for getting the size of a C-style
array: llvm::array_lengthof. This is useful prior to C++17, but not as
helpful for C++17 or later: std::size already has support for C-style
arrays.

Change call sites to use std::size instead.

Diff Detail

Event Timeline

jloser created this revision.Sep 6 2022, 5:03 PM
jloser requested review of this revision.Sep 6 2022, 5:03 PM
jloser updated this revision to Diff 458330.Sep 6 2022, 5:39 PM

Remove #include <iterator> from SPIRVBase.td

rriddle accepted this revision.Sep 6 2022, 5:40 PM

Nice!

This revision is now accepted and ready to land.Sep 6 2022, 5:40 PM
antiagainst accepted this revision.Sep 7 2022, 8:06 AM

Cool! Just one nit about formatting.

mlir/lib/Dialect/SPIRV/IR/SPIRVTypes.cpp
635

Format needs to be adjusted here?

jloser updated this revision to Diff 458458.Sep 7 2022, 8:11 AM

clang-format and rebase

jloser marked an inline comment as done.Sep 7 2022, 8:12 AM
jloser added inline comments.
mlir/lib/Dialect/SPIRV/IR/SPIRVTypes.cpp
635

Yep, I just ran git clang-format to fix this up — thanks!

This revision was automatically updated to reflect the committed changes.
jloser marked an inline comment as done.