Revert "ASTReader: Copy input file offset data to avoid unaligned accesses"
authorJustin Bogner <mail@justinbogner.com>
Sun, 21 Jun 2015 20:32:36 +0000 (20:32 +0000)
committerJustin Bogner <mail@justinbogner.com>
Sun, 21 Jun 2015 20:32:36 +0000 (20:32 +0000)
We can do this better by changing the type to unaligned_uint64_t and
paying the cost on use instead of up front.

This reverts r240228

llvm-svn: 240246

clang/include/clang/Serialization/Module.h
clang/lib/Serialization/ASTReader.cpp

index 48715e3..5571d91 100644 (file)
@@ -206,7 +206,7 @@ public:
   llvm::BitstreamCursor InputFilesCursor;
 
   /// \brief Offsets for all of the input file entries in the AST file.
-  std::vector<uint64_t> InputFileOffsets;
+  const uint64_t *InputFileOffsets;
 
   /// \brief The input files that have been loaded from this AST file.
   std::vector<InputFile> InputFilesLoaded;
index af6f92a..d75b5eb 100644 (file)
@@ -2304,21 +2304,13 @@ ASTReader::ReadControlBlock(ModuleFile &F,
         return Result;
       break;
 
-    case INPUT_FILE_OFFSETS: {
+    case INPUT_FILE_OFFSETS:
       NumInputs = Record[0];
       NumUserInputs = Record[1];
-      F.InputFileOffsets.clear();
-      F.InputFileOffsets.reserve(NumInputs);
-      using namespace llvm::support;
-      const char *Buf = Blob.data();
-      for (unsigned int I = 0; I < NumInputs; ++I)
-        F.InputFileOffsets.push_back(
-            endian::readNext<uint64_t, native, unaligned>(Buf));
-
+      F.InputFileOffsets = (const uint64_t *)Blob.data();
       F.InputFilesLoaded.resize(NumInputs);
       break;
     }
-    }
   }
 }