This is an archive of the discontinued LLVM Phabricator instance.

[IR] Return AAMDNodes from Instruction::getMetadata() (NFC)
ClosedPublic

Authored by nikic on Sep 15 2021, 2:03 PM.

Details

Summary

getMetadata() currently uses a weird API where it populates a structure passed to it, and optionally merges into it. Instead, we can return the AAMDNodes and provide a separate merge() API. This makes usages more compact.

Diff Detail

Event Timeline

nikic created this revision.Sep 15 2021, 2:03 PM
nikic requested review of this revision.Sep 15 2021, 2:03 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 15 2021, 2:03 PM
This revision is now accepted and ready to land.Sep 16 2021, 9:31 AM
This revision was landed with ongoing or failed builds.Sep 16 2021, 12:07 PM
This revision was automatically updated to reflect the committed changes.
llvm/lib/Transforms/Utils/SimplifyCFG.cpp
3489

Btw, nice bug fix ;)

llvm/include/llvm/IR/Metadata.h
713

Maybe interesting to add a LLVM_NODISCARD ? This should avoid missuses like:

Nodes.merge(OtherNodes);