[PATCH] D35037: Bitcode: Include any strings added to the string table in the module hash.

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 6 09:10:58 PDT 2017


tejohnson added a comment.

Looks ok but a couple of clarifying questions below.



================
Comment at: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:956
+  if (GenerateHash)
+    Hasher.update(Str);
+  return StrtabBuilder.add(Str);
----------------
Out of curiosity, couldn't the Hasher be updated with the contents of the StrtabBuilder when we writeModuleHash? I guess that would require finalizing the StrtabBuilder a little earlier - ah, we need to add to the StrtabBuilder when building the symtab. 



================
Comment at: llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp:660
+      if (BlockID == bitc::MODULE_BLOCK_ID && Code == bitc::MODULE_CODE_HASH &&
+          !CheckHash.empty()) {
         if (Record.size() != 5)
----------------
It's unfortunate that we need to explicitly pass in the expected strtab contents rather than just using the STRTAB_BLOB, but I guess here too the issue is that the final strtab included strings that were in the symtab that we didn't have when writing the module hash?


https://reviews.llvm.org/D35037





More information about the llvm-commits mailing list