This is an archive of the discontinued LLVM Phabricator instance.

[Libomptarget] Replace std::vector with llvm::SmallVector
ClosedPublic

Authored by jhuber6 on Aug 1 2022, 12:13 PM.

Details

Summary

The runtime makes some use of std::vector data structures. We should
be able to replace these trivially with llvm::SmallVector instead.
This should allow us to avoid heap allocations in the majority of cases
now.

Diff Detail

Event Timeline

jhuber6 created this revision.Aug 1 2022, 12:13 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 1 2022, 12:13 PM
jhuber6 requested review of this revision.Aug 1 2022, 12:13 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 1 2022, 12:13 PM
tianshilei1992 accepted this revision.Aug 1 2022, 12:32 PM

LGTM with nits.

openmp/libomptarget/include/device.h
24–25

Generally it will be a good practice to include the header wherever it is used instead of indirect include.

openmp/libomptarget/src/omptarget.cpp
389–393

probably worth to using llvm::SmallVector in those cpp files.

This revision is now accepted and ready to land.Aug 1 2022, 12:32 PM
This revision was automatically updated to reflect the committed changes.