[clang] 9eba6b2 - Revert "[Modules] Add stats to measure performance of building and loading modules."

Volodymyr Sapsai via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 24 12:37:51 PDT 2020


Author: Volodymyr Sapsai
Date: 2020-09-24T12:36:06-07:00
New Revision: 9eba6b20a0579d3441e1b0f3cb3942f86d32679f

URL: https://github.com/llvm/llvm-project/commit/9eba6b20a0579d3441e1b0f3cb3942f86d32679f
DIFF: https://github.com/llvm/llvm-project/commit/9eba6b20a0579d3441e1b0f3cb3942f86d32679f.diff

LOG: Revert "[Modules] Add stats to measure performance of building and loading modules."

This reverts commit c4bacc3c9b333bb7032fb96f41d6f5b851623132.

Test "LLVM :: ThinLTO/X86/funcimport-stats.ll" is failing. Reverting now
and will recommit after making the test not fail with the added stats.

Added: 
    

Modified: 
    clang/lib/Frontend/CompilerInstance.cpp
    clang/lib/Serialization/ASTReader.cpp
    llvm/lib/Support/MemoryBuffer.cpp
    llvm/lib/Support/Path.cpp
    llvm/lib/Support/Unix/Path.inc
    llvm/lib/Support/Windows/Path.inc

Removed: 
    


################################################################################
diff  --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp
index 445049324780..4613ed8d7f61 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -55,10 +55,6 @@
 
 using namespace clang;
 
-#define DEBUG_TYPE "modules"
-
-ALWAYS_ENABLED_STATISTIC(NumCompiledModules, "Number of compiled modules.");
-
 CompilerInstance::CompilerInstance(
     std::shared_ptr<PCHContainerOperations> PCHContainerOps,
     InMemoryModuleCache *SharedModuleCache)
@@ -1067,7 +1063,6 @@ compileModuleImpl(CompilerInstance &ImportingInstance, SourceLocation ImportLoc,
                   llvm::function_ref<void(CompilerInstance &)> PostBuildStep =
                       [](CompilerInstance &) {}) {
   llvm::TimeTraceScope TimeScope("Module Compile", ModuleName);
-  ++NumCompiledModules;
 
   // Construct a compiler invocation for creating this module.
   auto Invocation =

diff  --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index e71d73310d52..b2780db85166 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -100,7 +100,6 @@
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/SmallVector.h"
-#include "llvm/ADT/Statistic.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
@@ -143,15 +142,6 @@ using namespace clang::serialization::reader;
 using llvm::BitstreamCursor;
 using llvm::RoundingMode;
 
-#define DEBUG_TYPE "modules"
-
-ALWAYS_ENABLED_STATISTIC(NumTryLoadModule, "Number of times tried to load a "
-                                           "module. Includes failed attempts "
-                                           "and using cached results.");
-ALWAYS_ENABLED_STATISTIC(NumReadASTCore,
-                         "Number of ReadASTCore() invocations. Includes only "
-                         "actual AST core parsing and ignores cached results.");
-
 //===----------------------------------------------------------------------===//
 // ChainedASTReaderListener implementation
 //===----------------------------------------------------------------------===//
@@ -4213,7 +4203,6 @@ ASTReader::ASTReadResult ASTReader::ReadAST(StringRef FileName,
                                             SourceLocation ImportLoc,
                                             unsigned ClientLoadCapabilities,
                                             SmallVectorImpl<ImportedSubmodule> *Imported) {
-  ++NumTryLoadModule;
   llvm::SaveAndRestore<SourceLocation>
     SetCurImportLocRAII(CurrentImportLoc, ImportLoc);
 
@@ -4563,7 +4552,6 @@ ASTReader::ReadASTCore(StringRef FileName,
     return Failure;
   }
 
-  ++NumReadASTCore;
   // This is used for compatibility with older PCH formats.
   bool HaveReadControlBlock = false;
   while (true) {

diff  --git a/llvm/lib/Support/MemoryBuffer.cpp b/llvm/lib/Support/MemoryBuffer.cpp
index 4b851a20fc48..248fb72c4968 100644
--- a/llvm/lib/Support/MemoryBuffer.cpp
+++ b/llvm/lib/Support/MemoryBuffer.cpp
@@ -12,7 +12,6 @@
 
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/ADT/SmallString.h"
-#include "llvm/ADT/Statistic.h"
 #include "llvm/Config/config.h"
 #include "llvm/Support/Errc.h"
 #include "llvm/Support/Errno.h"
@@ -35,12 +34,6 @@
 #endif
 using namespace llvm;
 
-#define DEBUG_TYPE "memory-buffer"
-
-ALWAYS_ENABLED_STATISTIC(NumMmapFile, "Number of mmap-ed files.");
-ALWAYS_ENABLED_STATISTIC(NumAllocFile,
-                         "Number of files read into allocated memory buffer.");
-
 //===----------------------------------------------------------------------===//
 // MemoryBuffer implementation itself.
 //===----------------------------------------------------------------------===//
@@ -456,10 +449,8 @@ getOpenFileImpl(sys::fs::file_t FD, const Twine &Filename, uint64_t FileSize,
       // buffer by copying off the stream.
       sys::fs::file_type Type = Status.type();
       if (Type != sys::fs::file_type::regular_file &&
-          Type != sys::fs::file_type::block_file) {
-        ++NumAllocFile;
+          Type != sys::fs::file_type::block_file)
         return getMemoryBufferForStream(FD, Filename);
-      }
 
       FileSize = Status.getSize();
     }
@@ -472,10 +463,8 @@ getOpenFileImpl(sys::fs::file_t FD, const Twine &Filename, uint64_t FileSize,
     std::unique_ptr<MB> Result(
         new (NamedBufferAlloc(Filename)) MemoryBufferMMapFile<MB>(
             RequiresNullTerminator, FD, MapSize, Offset, EC));
-    if (!EC) {
-      ++NumMmapFile;
+    if (!EC)
       return std::move(Result);
-    }
   }
 
   auto Buf = WritableMemoryBuffer::getNewUninitMemBuffer(MapSize, Filename);
@@ -486,7 +475,6 @@ getOpenFileImpl(sys::fs::file_t FD, const Twine &Filename, uint64_t FileSize,
   }
 
   // Read until EOF, zero-initialize the rest.
-  ++NumAllocFile;
   MutableArrayRef<char> ToRead = Buf->getBuffer();
   while (!ToRead.empty()) {
     Expected<size_t> ReadBytes =

diff  --git a/llvm/lib/Support/Path.cpp b/llvm/lib/Support/Path.cpp
index 7f4b7cbdc31e..bbc02a246a50 100644
--- a/llvm/lib/Support/Path.cpp
+++ b/llvm/lib/Support/Path.cpp
@@ -12,7 +12,6 @@
 
 #include "llvm/Support/Path.h"
 #include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/Statistic.h"
 #include "llvm/Config/llvm-config.h"
 #include "llvm/Support/Endian.h"
 #include "llvm/Support/Errc.h"
@@ -32,10 +31,6 @@
 using namespace llvm;
 using namespace llvm::support::endian;
 
-#define DEBUG_TYPE "file-system"
-
-ALWAYS_ENABLED_STATISTIC(NumStatusCalls, "Number of `status` calls.");
-
 namespace {
   using llvm::StringRef;
   using llvm::sys::path::is_separator;

diff  --git a/llvm/lib/Support/Unix/Path.inc b/llvm/lib/Support/Unix/Path.inc
index 622d4fc5b4b1..01903ea10e81 100644
--- a/llvm/lib/Support/Unix/Path.inc
+++ b/llvm/lib/Support/Unix/Path.inc
@@ -736,7 +736,6 @@ static std::error_code fillStatus(int StatRet, const struct stat &Status,
 }
 
 std::error_code status(const Twine &Path, file_status &Result, bool Follow) {
-  ++NumStatusCalls;
   SmallString<128> PathStorage;
   StringRef P = Path.toNullTerminatedStringRef(PathStorage);
 
@@ -746,7 +745,6 @@ std::error_code status(const Twine &Path, file_status &Result, bool Follow) {
 }
 
 std::error_code status(int FD, file_status &Result) {
-  ++NumStatusCalls;
   struct stat Status;
   int StatRet = ::fstat(FD, &Status);
   return fillStatus(StatRet, Status, Result);

diff  --git a/llvm/lib/Support/Windows/Path.inc b/llvm/lib/Support/Windows/Path.inc
index cb7bf0beba1f..399b054d36bd 100644
--- a/llvm/lib/Support/Windows/Path.inc
+++ b/llvm/lib/Support/Windows/Path.inc
@@ -710,7 +710,6 @@ handle_status_error:
 }
 
 std::error_code status(const Twine &path, file_status &result, bool Follow) {
-  ++NumStatusCalls;
   SmallString<128> path_storage;
   SmallVector<wchar_t, 128> path_utf16;
 
@@ -743,13 +742,11 @@ std::error_code status(const Twine &path, file_status &result, bool Follow) {
 }
 
 std::error_code status(int FD, file_status &Result) {
-  ++NumStatusCalls;
   HANDLE FileHandle = reinterpret_cast<HANDLE>(_get_osfhandle(FD));
   return getStatus(FileHandle, Result);
 }
 
 std::error_code status(file_t FileHandle, file_status &Result) {
-  ++NumStatusCalls;
   return getStatus(FileHandle, Result);
 }
 


        


More information about the cfe-commits mailing list