Skip to content

Conversation

@snehasish
Copy link

This reverts commit 2e426fe.

@llvmbot llvmbot added PGO Profile Guided Optimizations llvm:transforms labels Aug 26, 2024
@llvmbot
Copy link
Member

llvmbot commented Aug 26, 2024

@llvm/pr-subscribers-pgo

@llvm/pr-subscribers-llvm-transforms

Author: Snehasish Kumar (snehasish)

Changes

This reverts commit 2e426fe.


Full diff: https://github.com/llvm/llvm-project/pull/106114.diff

5 Files Affected:

  • (modified) llvm/include/llvm/ProfileData/InstrProfReader.h (+2-6)
  • (modified) llvm/include/llvm/Transforms/Instrumentation/MemProfiler.h (+4-15)
  • (modified) llvm/lib/Transforms/Instrumentation/MemProfiler.cpp (+23-19)
  • (modified) llvm/unittests/Transforms/Instrumentation/CMakeLists.txt (-1)
  • (removed) llvm/unittests/Transforms/Instrumentation/MemProfilerTest.cpp (-158)
diff --git a/llvm/include/llvm/ProfileData/InstrProfReader.h b/llvm/include/llvm/ProfileData/InstrProfReader.h
index 95c891442fd6e9..3b307d08359980 100644
--- a/llvm/include/llvm/ProfileData/InstrProfReader.h
+++ b/llvm/include/llvm/ProfileData/InstrProfReader.h
@@ -670,11 +670,10 @@ class IndexedMemProfReader {
 
 public:
   IndexedMemProfReader() = default;
-  virtual ~IndexedMemProfReader() = default;
 
   Error deserialize(const unsigned char *Start, uint64_t MemProfOffset);
 
-  virtual Expected<memprof::MemProfRecord>
+  Expected<memprof::MemProfRecord>
   getMemProfRecord(const uint64_t FuncNameHash) const;
 };
 
@@ -769,14 +768,11 @@ class IndexedInstrProfReader : public InstrProfReader {
                      uint64_t *MismatchedFuncSum = nullptr);
 
   /// Return the memprof record for the function identified by
-  /// llvm::md5(Name). Marked virtual so that unit tests can mock this function.
+  /// llvm::md5(Name).
   Expected<memprof::MemProfRecord> getMemProfRecord(uint64_t FuncNameHash) {
     return MemProfReader.getMemProfRecord(FuncNameHash);
   }
 
-  /// Return the underlying memprof reader.
-  IndexedMemProfReader &getIndexedMemProfReader() { return MemProfReader; }
-
   /// Fill Counts with the profile data for the given function name.
   Error getFunctionCounts(StringRef FuncName, uint64_t FuncHash,
                           std::vector<uint64_t> &Counts);
diff --git a/llvm/include/llvm/Transforms/Instrumentation/MemProfiler.h b/llvm/include/llvm/Transforms/Instrumentation/MemProfiler.h
index c5d03c98f41581..f92c6b4775a2a2 100644
--- a/llvm/include/llvm/Transforms/Instrumentation/MemProfiler.h
+++ b/llvm/include/llvm/Transforms/Instrumentation/MemProfiler.h
@@ -13,15 +13,15 @@
 #define LLVM_TRANSFORMS_INSTRUMENTATION_MEMPROFILER_H
 
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
-#include "llvm/IR/ModuleSummaryIndex.h"
 #include "llvm/IR/PassManager.h"
-#include "llvm/ProfileData/InstrProfReader.h"
-#include "llvm/Support/VirtualFileSystem.h"
 
 namespace llvm {
 class Function;
 class Module;
-class TargetLibraryInfo;
+
+namespace vfs {
+class FileSystem;
+} // namespace vfs
 
 /// Public interface to the memory profiler pass for instrumenting code to
 /// profile memory accesses.
@@ -52,17 +52,6 @@ class MemProfUsePass : public PassInfoMixin<MemProfUsePass> {
                           IntrusiveRefCntPtr<vfs::FileSystem> FS = nullptr);
   PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
 
-  struct AllocMatchInfo {
-    uint64_t TotalSize = 0;
-    AllocationType AllocType = AllocationType::None;
-    bool Matched = false;
-  };
-
-  void
-  readMemprof(Function &F, const IndexedMemProfReader &MemProfReader,
-              const TargetLibraryInfo &TLI,
-              std::map<uint64_t, AllocMatchInfo> &FullStackIdToAllocMatchInfo);
-
 private:
   std::string MemoryProfileFileName;
   IntrusiveRefCntPtr<vfs::FileSystem> FS;
diff --git a/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp b/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
index bd10c037ecf4ad..4a43120c9a9e7f 100644
--- a/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
+++ b/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
@@ -39,6 +39,7 @@
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/HashBuilder.h"
+#include "llvm/Support/VirtualFileSystem.h"
 #include "llvm/TargetParser/Triple.h"
 #include "llvm/Transforms/Utils/BasicBlockUtils.h"
 #include "llvm/Transforms/Utils/ModuleUtils.h"
@@ -54,7 +55,6 @@ namespace llvm {
 extern cl::opt<bool> PGOWarnMissing;
 extern cl::opt<bool> NoPGOWarnMismatch;
 extern cl::opt<bool> NoPGOWarnMismatchComdatWeak;
-using AllocMatchInfo = ::llvm::MemProfUsePass::AllocMatchInfo;
 } // namespace llvm
 
 constexpr int LLVM_MEM_PROFILER_VERSION = 1;
@@ -148,11 +148,10 @@ static cl::opt<int> ClDebugMax("memprof-debug-max", cl::desc("Debug max inst"),
 
 // By default disable matching of allocation profiles onto operator new that
 // already explicitly pass a hot/cold hint, since we don't currently
-// override these hints anyway. Not static so that it can be set in the unit
-// test too.
-cl::opt<bool> ClMemProfMatchHotColdNew(
+// override these hints anyway.
+static cl::opt<bool> ClMemProfMatchHotColdNew(
     "memprof-match-hot-cold-new",
-    cl::desc(
+ cl::desc(
         "Match allocation profiles onto existing hot/cold operator new calls"),
     cl::Hidden, cl::init(false));
 
@@ -790,11 +789,17 @@ static bool isAllocationWithHotColdVariant(Function *Callee,
   }
 }
 
-void MemProfUsePass::readMemprof(
-    Function &F, const IndexedMemProfReader &MemProfReader,
-    const TargetLibraryInfo &TLI,
-    std::map<uint64_t, AllocMatchInfo> &FullStackIdToAllocMatchInfo) {
-  auto &Ctx = F.getContext();
+struct AllocMatchInfo {
+  uint64_t TotalSize = 0;
+  AllocationType AllocType = AllocationType::None;
+  bool Matched = false;
+};
+
+static void
+readMemprof(Module &M, Function &F, IndexedInstrProfReader *MemProfReader,
+            const TargetLibraryInfo &TLI,
+            std::map<uint64_t, AllocMatchInfo> &FullStackIdToAllocMatchInfo) {
+  auto &Ctx = M.getContext();
   // Previously we used getIRPGOFuncName() here. If F is local linkage,
   // getIRPGOFuncName() returns FuncName with prefix 'FileName;'. But
   // llvm-profdata uses FuncName in dwarf to create GUID which doesn't
@@ -805,7 +810,7 @@ void MemProfUsePass::readMemprof(
   auto FuncName = F.getName();
   auto FuncGUID = Function::getGUID(FuncName);
   std::optional<memprof::MemProfRecord> MemProfRec;
-  auto Err = MemProfReader.getMemProfRecord(FuncGUID).moveInto(MemProfRec);
+  auto Err = MemProfReader->getMemProfRecord(FuncGUID).moveInto(MemProfRec);
   if (Err) {
     handleAllErrors(std::move(Err), [&](const InstrProfError &IPE) {
       auto Err = IPE.get();
@@ -833,8 +838,8 @@ void MemProfUsePass::readMemprof(
                          Twine(" Hash = ") + std::to_string(FuncGUID))
                             .str();
 
-      Ctx.diagnose(DiagnosticInfoPGOProfile(F.getParent()->getName().data(),
-                                            Msg, DS_Warning));
+      Ctx.diagnose(
+          DiagnosticInfoPGOProfile(M.getName().data(), Msg, DS_Warning));
     });
     return;
   }
@@ -1031,15 +1036,15 @@ PreservedAnalyses MemProfUsePass::run(Module &M, ModuleAnalysisManager &AM) {
     return PreservedAnalyses::all();
   }
 
-  std::unique_ptr<IndexedInstrProfReader> IndexedReader =
+  std::unique_ptr<IndexedInstrProfReader> MemProfReader =
       std::move(ReaderOrErr.get());
-  if (!IndexedReader) {
+  if (!MemProfReader) {
     Ctx.diagnose(DiagnosticInfoPGOProfile(
-        MemoryProfileFileName.data(), StringRef("Cannot get IndexedReader")));
+        MemoryProfileFileName.data(), StringRef("Cannot get MemProfReader")));
     return PreservedAnalyses::all();
   }
 
-  if (!IndexedReader->hasMemoryProfile()) {
+  if (!MemProfReader->hasMemoryProfile()) {
     Ctx.diagnose(DiagnosticInfoPGOProfile(MemoryProfileFileName.data(),
                                           "Not a memory profile"));
     return PreservedAnalyses::all();
@@ -1052,13 +1057,12 @@ PreservedAnalyses MemProfUsePass::run(Module &M, ModuleAnalysisManager &AM) {
   // it to an allocation in the IR.
   std::map<uint64_t, AllocMatchInfo> FullStackIdToAllocMatchInfo;
 
-  const auto &MemProfReader = IndexedReader->getIndexedMemProfReader();
   for (auto &F : M) {
     if (F.isDeclaration())
       continue;
 
     const TargetLibraryInfo &TLI = FAM.getResult<TargetLibraryAnalysis>(F);
-    readMemprof(F, MemProfReader, TLI, FullStackIdToAllocMatchInfo);
+    readMemprof(M, F, MemProfReader.get(), TLI, FullStackIdToAllocMatchInfo);
   }
 
   if (ClPrintMemProfMatchInfo) {
diff --git a/llvm/unittests/Transforms/Instrumentation/CMakeLists.txt b/llvm/unittests/Transforms/Instrumentation/CMakeLists.txt
index 1afe1c339e4335..1f249b0049d062 100644
--- a/llvm/unittests/Transforms/Instrumentation/CMakeLists.txt
+++ b/llvm/unittests/Transforms/Instrumentation/CMakeLists.txt
@@ -9,7 +9,6 @@ set(LLVM_LINK_COMPONENTS
 
 add_llvm_unittest(InstrumentationTests
   PGOInstrumentationTest.cpp
-  MemProfilerTest.cpp
   )
 
 target_link_libraries(InstrumentationTests PRIVATE LLVMTestingSupport)
diff --git a/llvm/unittests/Transforms/Instrumentation/MemProfilerTest.cpp b/llvm/unittests/Transforms/Instrumentation/MemProfilerTest.cpp
deleted file mode 100644
index 844867d676e8dd..00000000000000
--- a/llvm/unittests/Transforms/Instrumentation/MemProfilerTest.cpp
+++ /dev/null
@@ -1,158 +0,0 @@
-//===- MemProfilerTest.cpp - MemProfiler unit tests ------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/Transforms/Instrumentation/MemProfiler.h"
-#include "llvm/ADT/StringRef.h"
-#include "llvm/Analysis/TargetLibraryInfo.h"
-#include "llvm/AsmParser/Parser.h"
-#include "llvm/IR/Attributes.h"
-#include "llvm/IR/Metadata.h"
-#include "llvm/IR/Module.h"
-#include "llvm/IR/PassManager.h"
-#include "llvm/Passes/PassBuilder.h"
-#include "llvm/ProfileData/InstrProfReader.h"
-#include "llvm/ProfileData/MemProf.h"
-#include "llvm/ProfileData/MemProfData.inc"
-#include "llvm/Support/Error.h"
-#include "llvm/Support/SourceMgr.h"
-
-#include "gmock/gmock.h"
-#include "gtest/gtest.h"
-
-extern llvm::cl::opt<bool> ClMemProfMatchHotColdNew;
-
-namespace llvm {
-namespace memprof {
-namespace {
-
-using ::testing::Return;
-using ::testing::SizeIs;
-
-struct MemProfilerTest : public ::testing::Test {
-  LLVMContext Context;
-  std::unique_ptr<Module> M;
-
-  MemProfilerTest() { ClMemProfMatchHotColdNew = true; }
-
-  void parseAssembly(const StringRef IR) {
-    SMDiagnostic Error;
-    M = parseAssemblyString(IR, Error, Context);
-    std::string ErrMsg;
-    raw_string_ostream OS(ErrMsg);
-    Error.print("", OS);
-
-    // A failure here means that the test itself is buggy.
-    if (!M)
-      report_fatal_error(OS.str().c_str());
-  }
-};
-
-// A mock memprof reader we can inject into the function we are testing.
-class MockMemProfReader : public IndexedMemProfReader {
-public:
-  MOCK_METHOD(Expected<MemProfRecord>, getMemProfRecord,
-              (const uint64_t FuncNameHash), (const, override));
-
-  // A helper function to create mock records from frames.
-  static MemProfRecord makeRecord(ArrayRef<ArrayRef<Frame>> AllocFrames) {
-    MemProfRecord Record;
-    MemInfoBlock Info;
-    // Mimic values which will be below the cold threshold.
-    Info.AllocCount = 1, Info.TotalSize = 550;
-    Info.TotalLifetime = 1000 * 1000, Info.TotalLifetimeAccessDensity = 1;
-    for (const auto &Callstack : AllocFrames) {
-      AllocationInfo AI;
-      AI.Info = PortableMemInfoBlock(Info, getHotColdSchema());
-      AI.CallStack = std::vector(Callstack.begin(), Callstack.end());
-      Record.AllocSites.push_back(AI);
-    }
-    return Record;
-  }
-};
-
-TEST_F(MemProfilerTest, AnnotatesCall) {
-  parseAssembly(R"IR(
-    target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
-    target triple = "x86_64-unknown-linux-gnu"
-
-    define void @_Z3foov() !dbg !10 {
-    entry:
-      %c1 = call {ptr, i64} @__size_returning_new(i64 32), !dbg !13
-      %c2 = call {ptr, i64} @__size_returning_new_aligned(i64 32, i64 8), !dbg !14
-      %c3 = call {ptr, i64} @__size_returning_new_hot_cold(i64 32, i8 254), !dbg !15
-      %c4 = call {ptr, i64} @__size_returning_new_aligned_hot_cold(i64 32, i64 8, i8 254), !dbg !16
-      ret void
-    }
-
-    declare {ptr, i64} @__size_returning_new(i64)
-    declare {ptr, i64} @__size_returning_new_aligned(i64, i64)
-    declare {ptr, i64} @__size_returning_new_hot_cold(i64, i8)
-    declare {ptr, i64} @__size_returning_new_aligned_hot_cold(i64, i64, i8)
-
-    !llvm.dbg.cu = !{!0}
-    !llvm.module.flags = !{!2, !3}
-
-    !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1)
-    !1 = !DIFile(filename: "mock_file.cc", directory: "mock_dir")
-    !2 = !{i32 7, !"Dwarf Version", i32 5}
-    !3 = !{i32 2, !"Debug Info Version", i32 3}
-    !10 = distinct !DISubprogram(name: "foo", linkageName: "_Z3foov", scope: !1, file: !1, line: 4, type: !11, scopeLine: 4, unit: !0, retainedNodes: !12)
-    !11 = !DISubroutineType(types: !12)
-    !12 = !{}
-    !13 = !DILocation(line: 5, column: 10, scope: !10)
-    !14 = !DILocation(line: 6, column: 10, scope: !10)
-    !15 = !DILocation(line: 7, column: 10, scope: !10)
-    !16 = !DILocation(line: 8, column: 10, scope: !10)
-  )IR");
-
-  auto *F = M->getFunction("_Z3foov");
-  ASSERT_NE(F, nullptr);
-
-  TargetLibraryInfoWrapperPass WrapperPass;
-  auto &TLI = WrapperPass.getTLI(*F);
-
-  auto Guid = Function::getGUID("_Z3foov");
-  // All the allocation sites are in foo().
-  MemProfRecord MockRecord =
-      MockMemProfReader::makeRecord({{Frame(Guid, 1, 10, false)},
-                                     {Frame(Guid, 2, 10, false)},
-                                     {Frame(Guid, 3, 10, false)},
-                                     {Frame(Guid, 4, 10, false)}});
-  // Set up mocks for the reader.
-  MockMemProfReader Reader;
-  EXPECT_CALL(Reader, getMemProfRecord(Guid)).WillOnce(Return(MockRecord));
-
-  MemProfUsePass Pass("/unused/profile/path");
-  std::map<uint64_t, MemProfUsePass::AllocMatchInfo> Unused;
-  Pass.readMemprof(*F, Reader, TLI, Unused);
-
-  // Since we only have a single type of behaviour for each allocation site, we
-  // only get function attributes.
-  std::vector<llvm::Attribute> CallsiteAttrs;
-  for (const auto &BB : *F) {
-    for (const auto &I : BB) {
-      if (auto *CI = dyn_cast<CallInst>(&I)) {
-        if (!CI->getCalledFunction()->getName().starts_with(
-                "__size_returning_new"))
-          continue;
-        Attribute Attr = CI->getFnAttr("memprof");
-        // The attribute will be invalid if it didn't find one named memprof.
-        ASSERT_TRUE(Attr.isValid());
-        CallsiteAttrs.push_back(Attr);
-      }
-    }
-  }
-
-  // We match all the variants including ones with the hint since we set
-  // ClMemProfMatchHotColdNew to true.
-  EXPECT_THAT(CallsiteAttrs, SizeIs(4));
-}
-
-} // namespace
-} // namespace memprof
-} // namespace llvm

@github-actions
Copy link

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff 7fc67b5eb53e3b99a99406ae39fba71c3f5538de 850482d1c827d3b6a2931f6d66e5359df65f1b67 --extensions h,cpp -- llvm/include/llvm/ProfileData/InstrProfReader.h llvm/include/llvm/Transforms/Instrumentation/MemProfiler.h llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
View the diff from clang-format here.
diff --git a/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp b/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
index 4a43120c9a..15fd983244 100644
--- a/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
+++ b/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
@@ -151,7 +151,7 @@ static cl::opt<int> ClDebugMax("memprof-debug-max", cl::desc("Debug max inst"),
 // override these hints anyway.
 static cl::opt<bool> ClMemProfMatchHotColdNew(
     "memprof-match-hot-cold-new",
- cl::desc(
+    cl::desc(
         "Match allocation profiles onto existing hot/cold operator new calls"),
     cl::Hidden, cl::init(false));
 

@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 26, 2024

LLVM Buildbot has detected a new failure on builder libc-riscv64-debian-dbg running on libc-riscv64-debian while building llvm at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/188/builds/3388

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py ...' (failure)
...
[ RUN      ] LlvmLibcVASPrintfTest.PercentConv
[       OK ] LlvmLibcVASPrintfTest.PercentConv (18 us)
[ RUN      ] LlvmLibcVASPrintfTest.CharConv
[       OK ] LlvmLibcVASPrintfTest.CharConv (19 us)
[ RUN      ] LlvmLibcVASPrintfTest.LargeStringNoConv
[       OK ] LlvmLibcVASPrintfTest.LargeStringNoConv (132 us)
[ RUN      ] LlvmLibcVASPrintfTest.ManyReAlloc
[       OK ] LlvmLibcVASPrintfTest.ManyReAlloc (45 us)
Ran 5 tests.  PASS: 5  FAIL: 0
[953/1124] Running unit test libc.test.src.stdio.vfscanf_test.__unit__
FAILED: projects/libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.vfscanf_test.__unit__ /home/libc_worker/libc-riscv64-debian/libc-riscv64-debian-dbg/build/projects/libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.vfscanf_test.__unit__ 
cd /home/libc_worker/libc-riscv64-debian/libc-riscv64-debian-dbg/build/projects/libc/test/src/stdio && /home/libc_worker/libc-riscv64-debian/libc-riscv64-debian-dbg/build/projects/libc/test/src/stdio/libc.test.src.stdio.vfscanf_test.__unit__.__build__
[==========] Running 1 test from 1 test suite.
[ RUN      ] LlvmLibcFScanfTest.WriteToFile
/home/libc_worker/libc-riscv64-debian/libc-riscv64-debian-dbg/llvm-project/libc/test/src/stdio/vfscanf_test.cpp:80: FAILURE
      Expected: read
      Which is: 0
To be equal to: 1
      Which is: 1
[  FAILED  ] LlvmLibcFScanfTest.WriteToFile
Ran 1 tests.  PASS: 0  FAIL: 1
[954/1124] Running unit test libc.test.src.stdio.fscanf_test.__unit__
[==========] Running 1 test from 1 test suite.
[ RUN      ] LlvmLibcFScanfTest.WriteToFile
[       OK ] LlvmLibcFScanfTest.WriteToFile (393 us)
Ran 1 tests.  PASS: 1  FAIL: 0
[955/1124] Running unit test libc.test.src.stdio.vsscanf_test.__unit__
[==========] Running 4 tests from 1 test suite.
[ RUN      ] LlvmLibcVSScanfTest.SimpleStringConv
[       OK ] LlvmLibcVSScanfTest.SimpleStringConv (36 us)
[ RUN      ] LlvmLibcVSScanfTest.IntConvSimple
[       OK ] LlvmLibcVSScanfTest.IntConvSimple (62 us)
[ RUN      ] LlvmLibcVSScanfTest.IntConvLengthModifier
[       OK ] LlvmLibcVSScanfTest.IntConvLengthModifier (43 us)
[ RUN      ] LlvmLibcVSScanfTest.IntConvBaseSelection
[       OK ] LlvmLibcVSScanfTest.IntConvBaseSelection (13 us)
Ran 4 tests.  PASS: 4  FAIL: 0
[956/1124] Running unit test libc.test.src.stdio.sprintf_test.__unit__
[==========] Running 19 tests from 1 test suite.
[ RUN      ] LlvmLibcSPrintfTest.Macros
[       OK ] LlvmLibcSPrintfTest.Macros (73 us)
[ RUN      ] LlvmLibcSPrintfTest.SimpleNoConv
[       OK ] LlvmLibcSPrintfTest.SimpleNoConv (8 us)
[ RUN      ] LlvmLibcSPrintfTest.PercentConv
[       OK ] LlvmLibcSPrintfTest.PercentConv (13 us)
[ RUN      ] LlvmLibcSPrintfTest.CharConv
[       OK ] LlvmLibcSPrintfTest.CharConv (17 us)
[ RUN      ] LlvmLibcSPrintfTest.StringConv
[       OK ] LlvmLibcSPrintfTest.StringConv (33 us)
Step 7 (libc-unit-tests) failure: libc-unit-tests (failure)
...
[ RUN      ] LlvmLibcVASPrintfTest.PercentConv
[       OK ] LlvmLibcVASPrintfTest.PercentConv (18 us)
[ RUN      ] LlvmLibcVASPrintfTest.CharConv
[       OK ] LlvmLibcVASPrintfTest.CharConv (19 us)
[ RUN      ] LlvmLibcVASPrintfTest.LargeStringNoConv
[       OK ] LlvmLibcVASPrintfTest.LargeStringNoConv (132 us)
[ RUN      ] LlvmLibcVASPrintfTest.ManyReAlloc
[       OK ] LlvmLibcVASPrintfTest.ManyReAlloc (45 us)
Ran 5 tests.  PASS: 5  FAIL: 0
[953/1124] Running unit test libc.test.src.stdio.vfscanf_test.__unit__
FAILED: projects/libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.vfscanf_test.__unit__ /home/libc_worker/libc-riscv64-debian/libc-riscv64-debian-dbg/build/projects/libc/test/src/stdio/CMakeFiles/libc.test.src.stdio.vfscanf_test.__unit__ 
cd /home/libc_worker/libc-riscv64-debian/libc-riscv64-debian-dbg/build/projects/libc/test/src/stdio && /home/libc_worker/libc-riscv64-debian/libc-riscv64-debian-dbg/build/projects/libc/test/src/stdio/libc.test.src.stdio.vfscanf_test.__unit__.__build__
[==========] Running 1 test from 1 test suite.
[ RUN      ] LlvmLibcFScanfTest.WriteToFile
/home/libc_worker/libc-riscv64-debian/libc-riscv64-debian-dbg/llvm-project/libc/test/src/stdio/vfscanf_test.cpp:80: FAILURE
      Expected: read
      Which is: 0
To be equal to: 1
      Which is: 1
[  FAILED  ] LlvmLibcFScanfTest.WriteToFile
Ran 1 tests.  PASS: 0  FAIL: 1
[954/1124] Running unit test libc.test.src.stdio.fscanf_test.__unit__
[==========] Running 1 test from 1 test suite.
[ RUN      ] LlvmLibcFScanfTest.WriteToFile
[       OK ] LlvmLibcFScanfTest.WriteToFile (393 us)
Ran 1 tests.  PASS: 1  FAIL: 0
[955/1124] Running unit test libc.test.src.stdio.vsscanf_test.__unit__
[==========] Running 4 tests from 1 test suite.
[ RUN      ] LlvmLibcVSScanfTest.SimpleStringConv
[       OK ] LlvmLibcVSScanfTest.SimpleStringConv (36 us)
[ RUN      ] LlvmLibcVSScanfTest.IntConvSimple
[       OK ] LlvmLibcVSScanfTest.IntConvSimple (62 us)
[ RUN      ] LlvmLibcVSScanfTest.IntConvLengthModifier
[       OK ] LlvmLibcVSScanfTest.IntConvLengthModifier (43 us)
[ RUN      ] LlvmLibcVSScanfTest.IntConvBaseSelection
[       OK ] LlvmLibcVSScanfTest.IntConvBaseSelection (13 us)
Ran 4 tests.  PASS: 4  FAIL: 0
[956/1124] Running unit test libc.test.src.stdio.sprintf_test.__unit__
[==========] Running 19 tests from 1 test suite.
[ RUN      ] LlvmLibcSPrintfTest.Macros
[       OK ] LlvmLibcSPrintfTest.Macros (73 us)
[ RUN      ] LlvmLibcSPrintfTest.SimpleNoConv
[       OK ] LlvmLibcSPrintfTest.SimpleNoConv (8 us)
[ RUN      ] LlvmLibcSPrintfTest.PercentConv
[       OK ] LlvmLibcSPrintfTest.PercentConv (13 us)
[ RUN      ] LlvmLibcSPrintfTest.CharConv
[       OK ] LlvmLibcSPrintfTest.CharConv (17 us)
[ RUN      ] LlvmLibcSPrintfTest.StringConv
[       OK ] LlvmLibcSPrintfTest.StringConv (33 us)

@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 26, 2024

LLVM Buildbot has detected a new failure on builder lldb-aarch64-ubuntu running on linaro-lldb-aarch64-ubuntu while building llvm at step 6 "test".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/59/builds/3798

Here is the relevant piece of the build log for the reference
Step 6 (test) failure: build (failure)
...
PASS: lldb-api :: commands/help/TestHelp.py (176 of 2016)
PASS: lldb-api :: commands/log/invalid-args/TestInvalidArgsLog.py (177 of 2016)
PASS: lldb-api :: commands/memory/write/TestMemoryWrite.py (178 of 2016)
PASS: lldb-api :: commands/platform/basic/TestPlatformCommand.py (179 of 2016)
PASS: lldb-api :: commands/platform/basic/TestPlatformPython.py (180 of 2016)
PASS: lldb-api :: commands/platform/file/close/TestPlatformFileClose.py (181 of 2016)
PASS: lldb-api :: commands/platform/file/read/TestPlatformFileRead.py (182 of 2016)
PASS: lldb-api :: commands/memory/read/TestMemoryRead.py (183 of 2016)
PASS: lldb-api :: commands/platform/connect/TestPlatformConnect.py (184 of 2016)
UNRESOLVED: lldb-api :: commands/gui/spawn-threads/TestGuiSpawnThreads.py (185 of 2016)
******************** TEST 'lldb-api :: commands/gui/spawn-threads/TestGuiSpawnThreads.py' FAILED ********************
Script:
--
/usr/bin/python3.10 /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/dotest.py -u CXXFLAGS -u CFLAGS --env ARCHIVER=/usr/local/bin/llvm-ar --env OBJCOPY=/usr/bin/llvm-objcopy --env LLVM_LIBS_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./lib --env LLVM_INCLUDE_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/include --env LLVM_TOOLS_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin --arch aarch64 --build-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex --lldb-module-cache-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api --clang-module-cache-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-clang/lldb-api --executable /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/lldb --compiler /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/clang --dsymutil /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/dsymutil --llvm-tools-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin --lldb-obj-root /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/tools/lldb --lldb-libs-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./lib /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/commands/gui/spawn-threads -p TestGuiSpawnThreads.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 20.0.0git (https://github.com/llvm/llvm-project.git revision 9b00ef5261b69541f36334308690420c99fd89f1)
  clang revision 9b00ef5261b69541f36334308690420c99fd89f1
  llvm revision 9b00ef5261b69541f36334308690420c99fd89f1
Skipping the following test categories: ['libc++', 'dsym', 'gmodules', 'debugserver', 'objc']

--
Command Output (stderr):
--
FAIL: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_gui (TestGuiSpawnThreads.TestGuiSpawnThreadsTest)
======================================================================
ERROR: test_gui (TestGuiSpawnThreads.TestGuiSpawnThreadsTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/decorators.py", line 148, in wrapper
    return func(*args, **kwargs)
  File "/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/commands/gui/spawn-threads/TestGuiSpawnThreads.py", line 44, in test_gui
    self.child.expect_exact(f"thread #{i + 2}: tid =")
  File "/usr/local/lib/python3.10/dist-packages/pexpect/spawnbase.py", line 432, in expect_exact
    return exp.expect_loop(timeout)
  File "/usr/local/lib/python3.10/dist-packages/pexpect/expect.py", line 179, in expect_loop
    return self.eof(e)
  File "/usr/local/lib/python3.10/dist-packages/pexpect/expect.py", line 122, in eof
    raise exc
pexpect.exceptions.EOF: End Of File (EOF). Exception style platform.
<pexpect.pty_spawn.spawn object at 0xffff78f14160>
command: /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/lldb
args: ['/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/lldb', '--no-lldbinit', '--no-use-colors', '-O', 'settings clear -all', '-O', 'settings set symbols.enable-external-lookup false', '-O', 'settings set target.inherit-tcc true', '-O', 'settings set target.disable-aslr false', '-O', 'settings set target.detach-on-error false', '-O', 'settings set target.auto-apply-fixits false', '-O', 'settings set plugin.process.gdb-remote.packet-timeout 60', '-O', 'settings set symbols.clang-modules-cache-path "/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api"', '-O', 'settings set use-color false', '--file', '/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/commands/gui/spawn-threads/TestGuiSpawnThreads.test_gui/a.out']
buffer (last 100 chars): b''
before (last 100 chars): b'thread_create.c:442:8\n#25 0x0000ffff83955edc ./misc/../sysdeps/unix/sysv/linux/aarch64/clone.S:82:0\n'
after: <class 'pexpect.exceptions.EOF'>

@llvm-ci
Copy link
Collaborator

llvm-ci commented Sep 15, 2024

LLVM Buildbot has detected a new failure on builder clang-s390x-linux-multistage running on systemz-1 while building llvm at step 5 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/98/builds/368

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'libFuzzer-s390x-default-Linux :: fuzzer-timeout.test' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/./bin/clang    -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta   --driver-mode=g++ -O2 -gline-tables-only -fsanitize=address,fuzzer -I/home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/compiler-rt/lib/fuzzer  /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/compiler-rt/test/fuzzer/TimeoutTest.cpp -o /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/runtimes/runtimes-bins/compiler-rt/test/fuzzer/S390XDefaultLinuxConfig/Output/fuzzer-timeout.test.tmp-TimeoutTest
+ /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/./bin/clang -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta --driver-mode=g++ -O2 -gline-tables-only -fsanitize=address,fuzzer -I/home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/compiler-rt/lib/fuzzer /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/compiler-rt/test/fuzzer/TimeoutTest.cpp -o /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/runtimes/runtimes-bins/compiler-rt/test/fuzzer/S390XDefaultLinuxConfig/Output/fuzzer-timeout.test.tmp-TimeoutTest
RUN: at line 2: /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/./bin/clang    -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta   --driver-mode=g++ -O2 -gline-tables-only -fsanitize=address,fuzzer -I/home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/compiler-rt/lib/fuzzer  /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/compiler-rt/test/fuzzer/TimeoutEmptyTest.cpp -o /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/runtimes/runtimes-bins/compiler-rt/test/fuzzer/S390XDefaultLinuxConfig/Output/fuzzer-timeout.test.tmp-TimeoutEmptyTest
+ /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/./bin/clang -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta --driver-mode=g++ -O2 -gline-tables-only -fsanitize=address,fuzzer -I/home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/compiler-rt/lib/fuzzer /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/compiler-rt/test/fuzzer/TimeoutEmptyTest.cpp -o /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/runtimes/runtimes-bins/compiler-rt/test/fuzzer/S390XDefaultLinuxConfig/Output/fuzzer-timeout.test.tmp-TimeoutEmptyTest
RUN: at line 3: not  /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/runtimes/runtimes-bins/compiler-rt/test/fuzzer/S390XDefaultLinuxConfig/Output/fuzzer-timeout.test.tmp-TimeoutTest -timeout=1 2>&1 | FileCheck /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/compiler-rt/test/fuzzer/fuzzer-timeout.test --check-prefix=TimeoutTest
+ not /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/runtimes/runtimes-bins/compiler-rt/test/fuzzer/S390XDefaultLinuxConfig/Output/fuzzer-timeout.test.tmp-TimeoutTest -timeout=1
+ FileCheck /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/compiler-rt/test/fuzzer/fuzzer-timeout.test --check-prefix=TimeoutTest
RUN: at line 12: not  /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/runtimes/runtimes-bins/compiler-rt/test/fuzzer/S390XDefaultLinuxConfig/Output/fuzzer-timeout.test.tmp-TimeoutTest -timeout=1 /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/compiler-rt/test/fuzzer/hi.txt 2>&1 | FileCheck /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/compiler-rt/test/fuzzer/fuzzer-timeout.test --check-prefix=SingleInputTimeoutTest
+ FileCheck /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/compiler-rt/test/fuzzer/fuzzer-timeout.test --check-prefix=SingleInputTimeoutTest
+ not /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/runtimes/runtimes-bins/compiler-rt/test/fuzzer/S390XDefaultLinuxConfig/Output/fuzzer-timeout.test.tmp-TimeoutTest -timeout=1 /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/compiler-rt/test/fuzzer/hi.txt
RUN: at line 16: /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/runtimes/runtimes-bins/compiler-rt/test/fuzzer/S390XDefaultLinuxConfig/Output/fuzzer-timeout.test.tmp-TimeoutTest -timeout=1 -timeout_exitcode=0
+ /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/runtimes/runtimes-bins/compiler-rt/test/fuzzer/S390XDefaultLinuxConfig/Output/fuzzer-timeout.test.tmp-TimeoutTest -timeout=1 -timeout_exitcode=0
INFO: Running with entropic power schedule (0xFF, 100).
INFO: Seed: 3948995561
INFO: Loaded 1 modules   (13 inline 8-bit counters): 13 [0x2aa08be9e48, 0x2aa08be9e55), 
INFO: Loaded 1 PC tables (13 PCs): 13 [0x2aa08be9e58,0x2aa08be9f28), 
INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 4096 bytes
INFO: A corpus is not provided, starting from an empty corpus
#2	INITED cov: 2 ft: 2 corp: 1/1b exec/s: 0 rss: 31Mb
#714	NEW    cov: 3 ft: 3 corp: 2/2b lim: 11 exec/s: 0 rss: 32Mb L: 1/1 MS: 2 CopyPart-ChangeByte-
#716	NEW    cov: 4 ft: 4 corp: 3/4b lim: 11 exec/s: 0 rss: 32Mb L: 2/2 MS: 2 CrossOver-CrossOver-
#1157	NEW    cov: 5 ft: 5 corp: 4/6b lim: 14 exec/s: 0 rss: 32Mb L: 2/2 MS: 1 InsertByte-
#1253	NEW    cov: 6 ft: 6 corp: 5/16b lim: 14 exec/s: 0 rss: 32Mb L: 10/10 MS: 1 InsertRepeatedBytes-
#1314	REDUCE cov: 6 ft: 6 corp: 5/13b lim: 14 exec/s: 0 rss: 32Mb L: 7/7 MS: 1 CrossOver-
#1395	REDUCE cov: 6 ft: 6 corp: 5/11b lim: 14 exec/s: 0 rss: 32Mb L: 5/5 MS: 1 CrossOver-
#1451	REDUCE cov: 6 ft: 6 corp: 5/9b lim: 14 exec/s: 0 rss: 32Mb L: 3/3 MS: 1 EraseBytes-
ALARM: working on the last Unit for 1 seconds
       and the timeout value is 1 (use -timeout=N to change)
MS: 4 ChangeByte-ChangeBit-ChangeBit-ChangeByte-; base unit: 6953175bac4fadf804f2ad4e823a81d2e4ff89bb
0x48,0x69,0x21,
Hi!
artifact_prefix='./'; Test unit written to ./timeout-c0a0ad26a634840c67a210fefdda76577b03a111
Base64: SGkh
==3350266== ERROR: libFuzzer: timeout after 1 seconds
AddressSanitizer:DEADLYSIGNAL
=================================================================
AddressSanitizer:DEADLYSIGNAL
=================================================================
AddressSanitizer: CHECK failed: asan_report.cpp:199 "((current_error_.kind)) == ((kErrorKindInvalid))" (0x1, 0x0) (tid=3350266)
    <empty stack>

MS: 4 ChangeByte-ChangeBit-ChangeBit-ChangeByte-; base unit: 6953175bac4fadf804f2ad4e823a81d2e4ff89bb
0x48,0x69,0x21,
Hi!
artifact_prefix='./'; Test unit written to ./crash-c0a0ad26a634840c67a210fefdda76577b03a111
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

llvm:transforms PGO Profile Guided Optimizations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants