[PATCH] D47474: Implement cpu_dispatch/cpu_specific Multiversioning
Erich Keane via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 18 07:19:43 PDT 2018
erichkeane added a comment.
================
Comment at: include/clang/AST/Decl.h:2212-2213
+ bool isCpuDispatchMultiVersion() const;
+ bool isCpuSpecificMultiVersion() const;
+
----------------
aaron.ballman wrote:
> aaron.ballman wrote:
> > Pedantic nit: CPU instead of Cpu?
> Thoughts on `isCPUDispatchMultiVersion()` instead of `isCpuDispatchMultiVersion()`?
Well, I can definitely switch it back if CPU is your preference. Looking at it, we're probably about 75/25 in our codebase preferring CPU, so I prefer it as well.
================
Comment at: include/clang/Basic/Attr.td:851
+ let Spellings = [Clang<"cpu_specific">];
+ let Args = [VariadicIdentifierArgument<"Cpus">];
+ let Subjects = SubjectList<[Function]>;
----------------
aaron.ballman wrote:
> `Cpus` -> `CPUs` ?
So, I agree with you we should be consistent with spelling. However, in this case, I'd prefer not changing this one. This is what the generated code in Attrs.inc looks like if I change it:
typedef IdentifierInfo ** cPUs_iterator;
cPUs_iterator cPUs_begin() const { return cPUs_; }
cPUs_iterator cPUs_end() const { return cPUs_ + cPUs_Size; }
unsigned cPUs_size() const { return cPUs_Size; }
llvm::iterator_range<cPUs_iterator> cPUs() const { return llvm::make_range(cPUs_begin(), cPUs_end()); }
I think having "Cpus" in 2 places is way better than having to spell it as cPUs_begin. Your thoughts?
================
Comment at: lib/Sema/SemaOverload.cpp:9017
+
+ return (*FirstDiff.first)->getName() < (*FirstDiff.second)->getName();
+ }
----------------
aaron.ballman wrote:
> If there's no mismatch, doesn't this wind up dereferencing the end iterator of the range?
Yikes, you're right! However, that would require 2 declarations to have identical cpu_specific lists, which is against the rules previously enforced. I've put an assert in here to ensure that never happens.
https://reviews.llvm.org/D47474
More information about the cfe-commits
mailing list