[PATCH] D57699: [yaml::BinaryRef] Slight perf tuning (for llvm-exegesis analysis mode)
Phabricator via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 6 00:57:39 PST 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL353282: [yaml::BinaryRef] Slight perf tuning (for llvm-exegesis analysis mode) (authored by lebedevri, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D57699?vs=185080&id=185501#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D57699/new/
https://reviews.llvm.org/D57699
Files:
llvm/trunk/lib/ObjectYAML/YAML.cpp
Index: llvm/trunk/lib/ObjectYAML/YAML.cpp
===================================================================
--- llvm/trunk/lib/ObjectYAML/YAML.cpp
+++ llvm/trunk/lib/ObjectYAML/YAML.cpp
@@ -31,7 +31,7 @@
// TODO: Can we improve YAMLIO to permit a more accurate diagnostic here?
// (e.g. a caret pointing to the offending character).
for (unsigned I = 0, N = Scalar.size(); I != N; ++I)
- if (!isxdigit(Scalar[I]))
+ if (!llvm::isHexDigit(Scalar[I]))
return "BinaryRef hex string must contain only hex digits.";
Val = yaml::BinaryRef(Scalar);
return {};
@@ -43,8 +43,9 @@
return;
}
for (unsigned I = 0, N = Data.size(); I != N; I += 2) {
- uint8_t Byte;
- StringRef((const char *)&Data[I], 2).getAsInteger(16, Byte);
+ uint8_t Byte = llvm::hexDigitValue(Data[I]);
+ Byte <<= 4;
+ Byte |= llvm::hexDigitValue(Data[I + 1]);
OS.write(Byte);
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57699.185501.patch
Type: text/x-patch
Size: 907 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190206/9e2f169f/attachment.bin>
More information about the llvm-commits
mailing list