r240246 - Revert "ASTReader: Copy input file offset data to avoid unaligned accesses"

Justin Bogner mail at justinbogner.com
Sun Jun 21 13:32:37 PDT 2015


Author: bogner
Date: Sun Jun 21 15:32:36 2015
New Revision: 240246

URL: http://llvm.org/viewvc/llvm-project?rev=240246&view=rev
Log:
Revert "ASTReader: Copy input file offset data to avoid unaligned accesses"

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

Modified:
    cfe/trunk/include/clang/Serialization/Module.h
    cfe/trunk/lib/Serialization/ASTReader.cpp

Modified: cfe/trunk/include/clang/Serialization/Module.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/Module.h?rev=240246&r1=240245&r2=240246&view=diff
==============================================================================
--- cfe/trunk/include/clang/Serialization/Module.h (original)
+++ cfe/trunk/include/clang/Serialization/Module.h Sun Jun 21 15:32:36 2015
@@ -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;

Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=240246&r1=240245&r2=240246&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Sun Jun 21 15:32:36 2015
@@ -2304,21 +2304,13 @@ ASTReader::ReadControlBlock(ModuleFile &
         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;
     }
-    }
   }
 }
 





More information about the cfe-commits mailing list