[llvm] Revert #140650 and #140505 (PR #140973)

via llvm-commits llvm-commits at lists.llvm.org
Wed May 21 17:25:42 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-transforms

Author: Snehasish Kumar (snehasish)

<details>
<summary>Changes</summary>

This reverts commit 90daed32a82ad2695d27db285ac36f579f2b270e and
4cfbe55781cb8fb95568c9a8538912f68d2ff681.
These changes exposed cyclic dependencies when LLVM is configured with
modules `-DLLVM_ENABLE_MODULES=ON`.

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


4 Files Affected:

- (modified) llvm/include/llvm/Analysis/MemoryProfileInfo.h (+1-2) 
- (modified) llvm/include/llvm/IR/ModuleSummaryIndex.h (+21-1) 
- (removed) llvm/include/llvm/ProfileData/MemProfCommon.h (-43) 
- (modified) llvm/lib/Transforms/Instrumentation/MemProfiler.cpp (-1) 


``````````diff
diff --git a/llvm/include/llvm/Analysis/MemoryProfileInfo.h b/llvm/include/llvm/Analysis/MemoryProfileInfo.h
index 9fcb81a0a1b4c..1d98f86f50484 100644
--- a/llvm/include/llvm/Analysis/MemoryProfileInfo.h
+++ b/llvm/include/llvm/Analysis/MemoryProfileInfo.h
@@ -13,9 +13,8 @@
 #ifndef LLVM_ANALYSIS_MEMORYPROFILEINFO_H
 #define LLVM_ANALYSIS_MEMORYPROFILEINFO_H
 
-#include "llvm/IR/InstrTypes.h"
 #include "llvm/IR/Metadata.h"
-#include "llvm/ProfileData/MemProfCommon.h"
+#include "llvm/IR/ModuleSummaryIndex.h"
 #include <map>
 
 namespace llvm {
diff --git a/llvm/include/llvm/IR/ModuleSummaryIndex.h b/llvm/include/llvm/IR/ModuleSummaryIndex.h
index 23f9504b44fab..65e428a3adea7 100644
--- a/llvm/include/llvm/IR/ModuleSummaryIndex.h
+++ b/llvm/include/llvm/IR/ModuleSummaryIndex.h
@@ -27,7 +27,6 @@
 #include "llvm/IR/ConstantRange.h"
 #include "llvm/IR/GlobalValue.h"
 #include "llvm/IR/Module.h"
-#include "llvm/ProfileData/MemProfCommon.h"
 #include "llvm/Support/Allocator.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/InterleavedRange.h"
@@ -307,6 +306,14 @@ template <> struct DenseMapInfo<ValueInfo> {
   static unsigned getHashValue(ValueInfo I) { return hash_value(I.getRef()); }
 };
 
+// For optional hinted size reporting, holds a pair of the full stack id
+// (pre-trimming, from the full context in the profile), and the associated
+// total profiled size.
+struct ContextTotalSize {
+  uint64_t FullStackId;
+  uint64_t TotalSize;
+};
+
 /// Summary of memprof callsite metadata.
 struct CallsiteInfo {
   // Actual callee function.
@@ -343,6 +350,19 @@ inline raw_ostream &operator<<(raw_ostream &OS, const CallsiteInfo &SNI) {
   return OS;
 }
 
+// Allocation type assigned to an allocation reached by a given context.
+// More can be added, now this is cold, notcold and hot.
+// Values should be powers of two so that they can be ORed, in particular to
+// track allocations that have different behavior with different calling
+// contexts.
+enum class AllocationType : uint8_t {
+  None = 0,
+  NotCold = 1,
+  Cold = 2,
+  Hot = 4,
+  All = 7 // This should always be set to the OR of all values.
+};
+
 /// Summary of a single MIB in a memprof metadata on allocations.
 struct MIBInfo {
   // The allocation type for this profiled context.
diff --git a/llvm/include/llvm/ProfileData/MemProfCommon.h b/llvm/include/llvm/ProfileData/MemProfCommon.h
deleted file mode 100644
index a638824ec000e..0000000000000
--- a/llvm/include/llvm/ProfileData/MemProfCommon.h
+++ /dev/null
@@ -1,43 +0,0 @@
-//===- MemProfCommon.h - MemProf support ----------------*- C++ -*-===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-//
-// This file contains common types used by different parts of the MemProf code.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_PROFILEDATA_MEMPROFCOMMON_H
-#define LLVM_PROFILEDATA_MEMPROFCOMMON_H
-
-#include <cstdint>
-
-namespace llvm {
-
-// For optional hinted size reporting, holds a pair of the full stack id
-// (pre-trimming, from the full context in the profile), and the associated
-// total profiled size.
-struct ContextTotalSize {
-  uint64_t FullStackId;
-  uint64_t TotalSize;
-};
-
-// Allocation type assigned to an allocation reached by a given context.
-// More can be added, now this is cold, notcold and hot.
-// Values should be powers of two so that they can be ORed, in particular to
-// track allocations that have different behavior with different calling
-// contexts.
-enum class AllocationType : uint8_t {
-  None = 0,
-  NotCold = 1,
-  Cold = 2,
-  Hot = 4,
-  All = 7 // This should always be set to the OR of all values.
-};
-
-} // namespace llvm
-
-#endif // LLVM_PROFILEDATA_MEMPROFCOMMON_H
diff --git a/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp b/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
index 6538311571529..5982476f3994e 100644
--- a/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
+++ b/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
@@ -46,7 +46,6 @@
 #include "llvm/Transforms/Utils/ModuleUtils.h"
 #include <map>
 #include <set>
-#include <unordered_set>
 
 using namespace llvm;
 using namespace llvm::memprof;

``````````

</details>


https://github.com/llvm/llvm-project/pull/140973


More information about the llvm-commits mailing list