This is an archive of the discontinued LLVM Phabricator instance.

[SPIR-V] Use llvm::Optional for builtin lowering result.
ClosedPublic

Authored by zuban32 on Aug 27 2022, 4:30 PM.

Details

Summary

Replace result type std::pair<bool, bool> of lowerBuiltin with
a nice and convenient Optional<bool>.

Diff Detail

Event Timeline

zuban32 created this revision.Aug 27 2022, 4:30 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 27 2022, 4:30 PM
zuban32 requested review of this revision.Aug 27 2022, 4:30 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 27 2022, 4:30 PM
zuban32 edited the summary of this revision. (Show Details)Aug 27 2022, 4:38 PM
MaskRay accepted this revision.Aug 27 2022, 8:06 PM
This revision is now accepted and ready to land.Aug 27 2022, 8:06 PM

@zuban32, perhaps it's better to use llvm::Optional from llvm/ADT/Optional.h (see https://github.com/KhronosGroup/LLVM-SPIRV-Backend/pull/217/files). It's widely used in llvm. On other hand, std::optional is not used at all in llvm/lib (as I see in llvm15).

llvm/lib/Target/SPIRV/SPIRVBuiltins.h
24–25

We need to correct the description too, e.g.

/// \return A boolean value indicating the successful lowering, if the callee
/// is recognized as a builtin function.
zuban32 updated this revision to Diff 456223.Aug 28 2022, 5:29 PM
  • Address comments
zuban32 retitled this revision from [SPIR-V] Use std::optional for builtin lowering result. to [SPIR-V] Use llvm::Optional for builtin lowering result..Aug 28 2022, 5:45 PM
zuban32 edited the summary of this revision. (Show Details)
iliya-diyachkov accepted this revision.Aug 29 2022, 5:33 PM

It looks good to me.

zuban32 updated this revision to Diff 456817.Aug 30 2022, 4:35 PM
zuban32 marked an inline comment as done.
  • clang-format
This revision was landed with ongoing or failed builds.Aug 30 2022, 11:26 PM
This revision was automatically updated to reflect the committed changes.