[PATCH] D148812: [NFC][clang] Fix static analyzer concerns
Tom Honermann via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 20 14:09:30 PDT 2023
tahonermann added a comment.
With the exception of the case involving the `Policy` class, these changes all look fine to me.
================
Comment at: clang/utils/TableGen/RISCVVEmitter.cpp:562
if (UnMaskedPolicyScheme != PolicyScheme::SchemeNone)
- for (auto P : SupportedUnMaskedPolicies) {
+ for (const auto &P : SupportedUnMaskedPolicies) {
SmallVector<PrototypeDescriptor> PolicyPrototype =
----------------
erichkeane wrote:
> What type is 'P' here? What size is it? It is being used quite a few times in this loop, which means it would have to be pretty sizable to justify making it a reference unless it has a copy ctor of cost.
`P` is class `Policy` from `clang/include/clang/Support/RISCVVIntrinsicUtils.h`. It holds two enum values (with non-fixed underlying type) and has an implicit copy constructor, so cheap to copy. I suspect the code gen impact is negligible here, but I see no need for reference semantics. I recommend skipping this change.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148812/new/
https://reviews.llvm.org/D148812
More information about the cfe-commits
mailing list