[PATCH] D50839: [llvm] Optimize YAML::isNumeric
Zachary Turner via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 16 10:24:36 PDT 2018
zturner added inline comments.
================
Comment at: llvm/include/llvm/Support/YAMLTraits.h:454
+inline bool isNumeric(StringRef S) {
+ if (S.empty())
+ return false;
----------------
What would happen if we re-wrote this entire function as:
```
inline bool isNumeric(StringRef S) {
uint64_t N;
int64_t I;
APFloat F;
return S.getAsInteger(N) || S.getAsInteger(I) || (F.convertFromString(S) == opOK);
}
```
Would this a) Be correct, and b) have similar performance characteristics to what you've got here?
https://reviews.llvm.org/D50839
More information about the cfe-commits
mailing list