diff options
author | Mehdi Amini <mehdi.amini@apple.com> | 2016-04-01 03:03:21 +0000 |
---|---|---|
committer | Mehdi Amini <mehdi.amini@apple.com> | 2016-04-01 03:03:21 +0000 |
commit | 85fb9e058ed74ad9b4fe919056d1d6874f398b39 (patch) | |
tree | d0f0ef115da3cf8137ba894af8426b9c6e82ce71 /llvm/tools | |
parent | f83ab6de56eeb651b1ce06ea98ada9175a2beb17 (diff) | |
download | bcm5719-llvm-85fb9e058ed74ad9b4fe919056d1d6874f398b39.tar.gz bcm5719-llvm-85fb9e058ed74ad9b4fe919056d1d6874f398b39.zip |
Revert "Add support for computing SHA1 in LLVM"
This reverts commit r265096, r265095, and r265094.
Windows build is broken, and the validation does not pass.
From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 265102
Diffstat (limited to 'llvm/tools')
-rw-r--r-- | llvm/tools/llvm-as/llvm-as.cpp | 5 | ||||
-rw-r--r-- | llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp | 40 |
2 files changed, 1 insertions, 44 deletions
diff --git a/llvm/tools/llvm-as/llvm-as.cpp b/llvm/tools/llvm-as/llvm-as.cpp index 7e9500a6672..7318bfe341d 100644 --- a/llvm/tools/llvm-as/llvm-as.cpp +++ b/llvm/tools/llvm-as/llvm-as.cpp @@ -48,9 +48,6 @@ static cl::opt<bool> EmitSummaryIndex("module-summary", cl::desc("Emit module summary index"), cl::init(false)); -static cl::opt<bool> EmitModuleHash("module-hash", cl::desc("Emit module hash"), - cl::init(false)); - static cl::opt<bool> DumpAsm("d", cl::desc("Print assembly as parsed"), cl::Hidden); @@ -85,7 +82,7 @@ static void WriteOutputFile(const Module *M) { if (Force || !CheckBitcodeOutputToConsole(Out->os(), true)) WriteBitcodeToFile(M, Out->os(), PreserveBitcodeUseListOrder, - EmitSummaryIndex, EmitModuleHash); + EmitSummaryIndex); // Declare success. Out->keep(); diff --git a/llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp b/llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp index 85dd5f52daa..6645045db8f 100644 --- a/llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp +++ b/llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp @@ -29,7 +29,6 @@ #include "llvm/Bitcode/BitstreamReader.h" #include "llvm/ADT/Optional.h" -#include "llvm/ADT/StringExtras.h" #include "llvm/Bitcode/LLVMBitCodes.h" #include "llvm/Bitcode/ReaderWriter.h" #include "llvm/IR/Verifier.h" @@ -39,10 +38,8 @@ #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/PrettyStackTrace.h" #include "llvm/Support/Signals.h" -#include "llvm/Support/SHA1.h" #include "llvm/Support/raw_ostream.h" #include <algorithm> -#include <array> #include <cctype> #include <map> #include <system_error> @@ -177,7 +174,6 @@ static const char *GetCodeName(unsigned CodeID, unsigned BlockID, STRINGIFY_CODE(MODULE_CODE, VSTOFFSET) STRINGIFY_CODE(MODULE_CODE, METADATA_VALUES_UNUSED) STRINGIFY_CODE(MODULE_CODE, SOURCE_FILENAME) - STRINGIFY_CODE(MODULE_CODE, HASH) } case bitc::IDENTIFICATION_BLOCK_ID: switch (CodeID) { @@ -296,7 +292,6 @@ static const char *GetCodeName(unsigned CodeID, unsigned BlockID, default: return nullptr; STRINGIFY_CODE(MST_CODE, ENTRY) - STRINGIFY_CODE(MST_CODE, HASH) } case bitc::GLOBALVAL_SUMMARY_BLOCK_ID: switch (CodeID) { @@ -486,9 +481,6 @@ static bool ParseBlock(BitstreamCursor &Stream, unsigned BlockID, if (Stream.EnterSubBlock(BlockID, &NumWords)) return Error("Malformed block record"); - // Keep it for later, when we see a MODULE_HASH record - uint64_t BlockEntryPos = Stream.getCurrentByteNo(); - const char *BlockName = nullptr; if (DumpRecords) { outs() << Indent << "<"; @@ -560,7 +552,6 @@ static bool ParseBlock(BitstreamCursor &Stream, unsigned BlockID, ++BlockStats.NumRecords; StringRef Blob; - unsigned CurrentRecordPos = Stream.getCurrentByteNo(); unsigned Code = Stream.readRecord(Entry.ID, Record, &Blob); // Increment the # occurrences of this code. @@ -595,37 +586,6 @@ static bool ParseBlock(BitstreamCursor &Stream, unsigned BlockID, for (unsigned i = 0, e = Record.size(); i != e; ++i) outs() << " op" << i << "=" << (int64_t)Record[i]; - // If we found a module hash, let's verify that it matches! - if (BlockID == bitc::MODULE_BLOCK_ID && Code == bitc::MODULE_CODE_HASH) { - if (Record.size() != 5) - outs() << " (invalid)"; - else { - // Recompute the hash and compare it to the one in the bitcode - SHA1 Hasher; - StringRef Hash; - { - int BlockSize = CurrentRecordPos - BlockEntryPos; - auto Ptr = Stream.getPointerToByte(BlockEntryPos, BlockSize); - Hasher.update(ArrayRef<uint8_t>(Ptr, BlockSize)); - Hash = Hasher.result(); - } - SmallString<20> RecordedHash; - RecordedHash.resize(20); - 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; - } - if (Hash == RecordedHash) - outs() << " (match)"; - else - outs() << " (!mismatch!)"; - } - } - outs() << "/>"; if (Abbv) { |