[PATCH] D130778: [NFC] Simplify some conversions from ArrayRef to SmallVector by using to_vector and to_vector_of utilities
Dawid Jurczak via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 4 07:40:39 PDT 2022
yurai007 added inline comments.
================
Comment at: llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp:814
// Otherwise, create TBAA with the new Len
- ArrayRef<MDOperand> MDOperands = MD->operands();
- SmallVector<Metadata *, 4> NextNodes(MDOperands.begin(), MDOperands.end());
+ auto NextNodes = to_vector_of<Metadata *, 4>(MD->operands());
ConstantInt *PreviousSize = mdconst::extract<ConstantInt>(NextNodes[3]);
----------------
dblaikie wrote:
> I'm not sure changes like this add value - if we end up with a ctor that can take `MD->operands()` as a single argument. Is that possible already/will it be possible with some of the patches you're working on?
Taking into account parallel change which adds SmallVector(ArrayRef<U>) the answer is yes - NextNodes (SmallVector) can be created directly from MD->operands(). So yeah we can skip using to_vector_of here.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D130778/new/
https://reviews.llvm.org/D130778
More information about the llvm-commits
mailing list