[llvm] 9a9bc23 - [llvm-bcanalyzer] Simplify code. NFCI.
Benjamin Kramer via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 6 03:52:02 PDT 2020
Author: Benjamin Kramer
Date: 2020-04-06T12:50:50+02:00
New Revision: 9a9bc2367290b74f9b067948f5e18b04dae0baea
URL: https://github.com/llvm/llvm-project/commit/9a9bc2367290b74f9b067948f5e18b04dae0baea
DIFF: https://github.com/llvm/llvm-project/commit/9a9bc2367290b74f9b067948f5e18b04dae0baea.diff
LOG: [llvm-bcanalyzer] Simplify code. NFCI.
Added:
Modified:
llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp b/llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp
index e70caa83c8c1..69ab822a74bb 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp
@@ -910,17 +910,14 @@ Error BitcodeAnalyzer::parseBlock(unsigned BlockID, unsigned IndentLevel,
Hasher.update(ArrayRef<uint8_t>(Ptr, BlockSize));
Hash = Hasher.result();
}
- SmallString<20> RecordedHash;
- RecordedHash.resize(20);
+ std::array<char, 20> RecordedHash;
int Pos = 0;
for (auto &Val : Record) {
assert(!(Val >> 32) && "Unexpected high bits set");
- RecordedHash[Pos++] = (Val >> 24) & 0xFF;
- RecordedHash[Pos++] = (Val >> 16) & 0xFF;
- RecordedHash[Pos++] = (Val >> 8) & 0xFF;
- RecordedHash[Pos++] = (Val >> 0) & 0xFF;
+ support::endian::write32be(&RecordedHash[Pos], Val);
+ Pos += 4;
}
- if (Hash == RecordedHash)
+ if (Hash == StringRef(RecordedHash.data(), RecordedHash.size()))
O->OS << " (match)";
else
O->OS << " (!mismatch!)";
More information about the llvm-commits
mailing list