-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[NFC][MemProf] Move types shared between Analysis, ProfileData and ModuleSummary (Core) to a separate header #140505
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@llvm/pr-subscribers-pgo @llvm/pr-subscribers-llvm-analysis Author: Snehasish Kumar (snehasish) ChangesFull diff: https://github.com/llvm/llvm-project/pull/140505.diff 4 Files Affected:
diff --git a/llvm/include/llvm/Analysis/MemoryProfileInfo.h b/llvm/include/llvm/Analysis/MemoryProfileInfo.h
index 1d98f86f50484..33d59efe8d77e 100644
--- a/llvm/include/llvm/Analysis/MemoryProfileInfo.h
+++ b/llvm/include/llvm/Analysis/MemoryProfileInfo.h
@@ -14,7 +14,8 @@
#define LLVM_ANALYSIS_MEMORYPROFILEINFO_H
#include "llvm/IR/Metadata.h"
-#include "llvm/IR/ModuleSummaryIndex.h"
+#include "llvm/ProfileData/MemProfCommon.h"
+#include "llvm/IR/InstrTypes.h"
#include <map>
namespace llvm {
diff --git a/llvm/include/llvm/IR/ModuleSummaryIndex.h b/llvm/include/llvm/IR/ModuleSummaryIndex.h
index 65e428a3adea7..77430c5cb5ea1 100644
--- a/llvm/include/llvm/IR/ModuleSummaryIndex.h
+++ b/llvm/include/llvm/IR/ModuleSummaryIndex.h
@@ -27,6 +27,7 @@
#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"
@@ -306,13 +307,7 @@ 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 {
@@ -350,19 +345,6 @@ 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
new file mode 100644
index 0000000000000..4097ccb651188
--- /dev/null
+++ b/llvm/include/llvm/ProfileData/MemProfCommon.h
@@ -0,0 +1,44 @@
+//===- 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 5982476f3994e..6538311571529 100644
--- a/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
+++ b/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
@@ -46,6 +46,7 @@
#include "llvm/Transforms/Utils/ModuleUtils.h"
#include <map>
#include <set>
+#include <unordered_set>
using namespace llvm;
using namespace llvm::memprof;
|
|
@llvm/pr-subscribers-llvm-ir Author: Snehasish Kumar (snehasish) ChangesFull diff: https://github.com/llvm/llvm-project/pull/140505.diff 4 Files Affected:
diff --git a/llvm/include/llvm/Analysis/MemoryProfileInfo.h b/llvm/include/llvm/Analysis/MemoryProfileInfo.h
index 1d98f86f50484..33d59efe8d77e 100644
--- a/llvm/include/llvm/Analysis/MemoryProfileInfo.h
+++ b/llvm/include/llvm/Analysis/MemoryProfileInfo.h
@@ -14,7 +14,8 @@
#define LLVM_ANALYSIS_MEMORYPROFILEINFO_H
#include "llvm/IR/Metadata.h"
-#include "llvm/IR/ModuleSummaryIndex.h"
+#include "llvm/ProfileData/MemProfCommon.h"
+#include "llvm/IR/InstrTypes.h"
#include <map>
namespace llvm {
diff --git a/llvm/include/llvm/IR/ModuleSummaryIndex.h b/llvm/include/llvm/IR/ModuleSummaryIndex.h
index 65e428a3adea7..77430c5cb5ea1 100644
--- a/llvm/include/llvm/IR/ModuleSummaryIndex.h
+++ b/llvm/include/llvm/IR/ModuleSummaryIndex.h
@@ -27,6 +27,7 @@
#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"
@@ -306,13 +307,7 @@ 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 {
@@ -350,19 +345,6 @@ 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
new file mode 100644
index 0000000000000..4097ccb651188
--- /dev/null
+++ b/llvm/include/llvm/ProfileData/MemProfCommon.h
@@ -0,0 +1,44 @@
+//===- 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 5982476f3994e..6538311571529 100644
--- a/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
+++ b/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
@@ -46,6 +46,7 @@
#include "llvm/Transforms/Utils/ModuleUtils.h"
#include <map>
#include <set>
+#include <unordered_set>
using namespace llvm;
using namespace llvm::memprof;
|
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
d4413c6 to
8751ae1
Compare
teresajohnson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm with one question
532d85a to
36aeb3a
Compare
8751ae1 to
305e2bd
Compare
Merge activity
|
36aeb3a to
1b82b50
Compare
…duleSummary (Core) to a separate header
305e2bd to
f8b6b3c
Compare
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/10/builds/5660 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/138/builds/13356 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/205/builds/9796 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/203/builds/11005 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/206/builds/518 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/126/builds/3652 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/76/builds/9719 Here is the relevant piece of the build log for the reference |
chapuni
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you introduced weird deps. I suggest reverting.
|
|
||
| LINK_COMPONENTS | ||
| BitstreamReader | ||
| Core |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like ProfileData still depends on Core.
Fixed in #140650 |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/145/builds/7114 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/160/builds/17712 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/180/builds/17855 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/151/builds/5804 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/97/builds/6708 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/80/builds/13550 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/118/builds/6373 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/130/builds/13243 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/64/builds/3692 Here is the relevant piece of the build log for the reference |
|
This is breaking our internal builds. Please revert. |
|
I think the issue is when modules are turned on: fatal error: cyclic dependency in module 'LLVM_Object': LLVM_Object -> LLVM_IR -> LLVM_ProfileData -> LLVM_Object So the fix doesn't address this. |
Thanks, I was able to reproduce this. Taking a look now. |
|
@snehasish Thanks for the revert. |

Part of a larger refactoring with the following goals