[PATCH] D102180: [Clang][OpenMP] Emit dependent PreInits before directive.
Michael Kruse via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri May 14 14:40:08 PDT 2021
Meinersbur added inline comments.
================
Comment at: clang/lib/Sema/SemaOpenMP.cpp:12579
Stmt *Body = nullptr;
- SmallVector<Stmt *, 4> OriginalInits;
+ SmallVector<std::vector<llvm::PointerUnion<Stmt *, Decl *>>, 4> OriginalInits(1);
if (!OMPLoopBasedDirective::doForAllLoops(
----------------
ABataev wrote:
> Why still `std::vector`?
I didn't notice that the vector type was changed, only notices the added argument for one pre-allocated element.
The motivation for `std::vector` is lower memory requirement. `SmallVectorImpl` cannot be used because it it is nested in the template. `SmallVector` will pre-allocate a large amount of memory (times 4) and expensive to move when the outer SmallVector has to be resized.
However, I could also use `SmallVector<T, 0>`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D102180/new/
https://reviews.llvm.org/D102180
More information about the cfe-commits
mailing list