[PATCH] D50839: [llvm] Make YAML serialization up to 2.5 times faster
Andrea Di Biagio via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 20 02:58:42 PDT 2018
andreadb added a comment.
Hi Kirill,
================
Comment at: llvm/trunk/include/llvm/Support/YAMLTraits.h:464
- static const char HexChars[] = "0123456789abcdefABCDEF";
- if (S.startswith("0x") &&
- S.drop_front(2).find_first_not_of(HexChars) == StringRef::npos)
+ if (S.equals(".nan") || S.equals(".NaN") || S.equals(".NAN"))
return true;
----------------
You can probably use `StringRef::compare_lower()` rather than enumerating all the possible strings in input.
================
Comment at: llvm/trunk/include/llvm/Support/YAMLTraits.h:472
+ // expensive.
+ if (Tail.equals(".inf") || Tail.equals(".Inf") || Tail.equals(".INF"))
return true;
----------------
Same.
================
Comment at: llvm/trunk/include/llvm/Support/YAMLTraits.h:536
+
+ assert(FoundExponent && "Should have found exponent at this point.");
+ if (S.empty())
----------------
This assert is wrong.
It should be:
```
assert(State == FoundExponent && "Should have found exponent at this point.");
```
This is causing some spurious warnings on gcc.
```
YAMLTraits.h:536: warning: enum constant in boolean context [-Wint-in-bool-context].
Repository:
rL LLVM
https://reviews.llvm.org/D50839
More information about the llvm-commits
mailing list