Skip to content

Commit 14e06cc

Browse files
committed
Change other flag to positive intent too
1 parent e4afefc commit 14e06cc

File tree

3 files changed

+44
-45
lines changed

3 files changed

+44
-45
lines changed

llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,14 @@ static cl::opt<bool> AllowRecursiveCallsites(
127127
"memprof-allow-recursive-callsites", cl::init(true), cl::Hidden,
128128
cl::desc("Allow cloning of callsites involved in recursive cycles"));
129129

130-
// When enabled, try to detect and prevent cloning of recursive contexts.
130+
// When disabled, try to detect and prevent cloning of recursive contexts.
131131
// This is only necessary until we support cloning through recursive cycles.
132-
// Leave off by default for now, as it requires a little bit of compile time
133-
// overhead and doesn't affect correctness, it will just inflate the cold hinted
134-
// bytes reporting a bit when -memprof-report-hinted-sizes is enabled.
135-
static cl::opt<bool> SkipRecursiveContexts(
136-
"memprof-skip-recursive-contexts", cl::init(false), cl::Hidden,
137-
cl::desc("Prevent cloning of contexts through recursive cycles"));
132+
// Leave on by default for now, as disabling requires a little bit of compile
133+
// time overhead and doesn't affect correctness, it will just inflate the cold
134+
// hinted bytes reporting a bit when -memprof-report-hinted-sizes is enabled.
135+
static cl::opt<bool> AllowRecursiveContexts(
136+
"memprof-allow-recursive-contexts", cl::init(true), cl::Hidden,
137+
cl::desc("Allow cloning of contexts through recursive cycles"));
138138

139139
namespace llvm {
140140
cl::opt<bool> EnableMemProfContextDisambiguation(
@@ -1394,9 +1394,9 @@ static void checkNode(const ContextNode<DerivedCCG, FuncTy, CallTy> *Node,
13941394
}
13951395
// Node can have more context ids than callers if some contexts terminate at
13961396
// node and some are longer. If we are allowing recursive callsites but
1397-
// haven't enabled skipping of recursive contexts, this will be violated for
1397+
// haven't disabled recursive contexts, this will be violated for
13981398
// incompletely cloned recursive cycles, so skip the checking in that case.
1399-
assert((AllowRecursiveCallsites && !SkipRecursiveContexts) ||
1399+
assert((AllowRecursiveCallsites && AllowRecursiveContexts) ||
14001400
NodeContextIds == CallerEdgeContextIds ||
14011401
set_is_subset(CallerEdgeContextIds, NodeContextIds));
14021402
}
@@ -3392,10 +3392,9 @@ void CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::identifyClones(
33923392
assert(Node->AllocTypes != (uint8_t)AllocationType::None);
33933393

33943394
DenseSet<uint32_t> RecursiveContextIds;
3395-
// If we are allowing recursive callsites, and have also enabled
3396-
// skipping of recursive contexts, look for context ids that show up in
3397-
// multiple caller edges.
3398-
if (AllowRecursiveCallsites && SkipRecursiveContexts) {
3395+
// If we are allowing recursive callsites, but have also disabled recursive
3396+
// contexts, look for context ids that show up in multiple caller edges.
3397+
if (AllowRecursiveCallsites && !AllowRecursiveContexts) {
33993398
DenseSet<uint32_t> AllCallerContextIds;
34003399
for (auto &CE : Node->CallerEdges) {
34013400
// Resize to the largest set of caller context ids, since we know the

llvm/test/ThinLTO/X86/memprof-recursive.ll

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
; RUN: -pass-remarks=memprof-context-disambiguation \
2121
; RUN: -o %t.out 2>&1 | FileCheck %s \
2222
; RUN: --implicit-check-not "memprof_recursive3.cc:12:10: call in clone _Z1Ci.memprof.1 assigned" \
23-
; RUN: --check-prefix=NOSKIP-RECUR-CALLSITES --check-prefix=NOSKIP-RECUR-CONTEXTS
23+
; RUN: --check-prefix=ALLOW-RECUR-CALLSITES --check-prefix=ALLOW-RECUR-CONTEXTS
2424

2525
;; Skipping recursive callsites should result in no cloning.
2626
; RUN: llvm-lto2 run %t.o -enable-memprof-context-disambiguation \
@@ -50,23 +50,23 @@
5050
; RUN: -r=%t.o,_Znam, \
5151
; RUN: -memprof-verify-ccg -memprof-verify-nodes \
5252
; RUN: -pass-remarks=memprof-context-disambiguation \
53-
; RUN: -memprof-skip-recursive-contexts \
53+
; RUN: -memprof-allow-recursive-contexts=false \
5454
; RUN: -o %t.out 2>&1 | FileCheck %s \
5555
; RUN: --implicit-check-not "memprof_recursive3.cc:12:10: call in clone _Z1Ci.memprof.1 assigned" \
56-
; RUN: --check-prefix=NOSKIP-RECUR-CALLSITES --check-prefix=SKIP-RECUR-CONTEXTS
56+
; RUN: --check-prefix=ALLOW-RECUR-CALLSITES --check-prefix=SKIP-RECUR-CONTEXTS
5757

58-
; NOSKIP-RECUR-CALLSITES: memprof_recursive.cc:4:0: created clone _Z1Dv.memprof.1
59-
; NOSKIP-RECUR-CALLSITES: memprof_recursive.cc:5:10: call in clone _Z1Dv marked with memprof allocation attribute notcold
60-
; NOSKIP-RECUR-CALLSITES: memprof_recursive.cc:5:10: call in clone _Z1Dv.memprof.1 marked with memprof allocation attribute cold
61-
; NOSKIP-RECUR-CALLSITES: memprof_recursive.cc:8:0: created clone _Z1Ci.memprof.1
62-
; NOSKIP-RECUR-CALLSITES: memprof_recursive.cc:10:12: call in clone _Z1Ci.memprof.1 assigned to call function clone _Z1Dv.memprof.1
63-
; NOSKIP-RECUR-CALLSITES: memprof_recursive.cc:14:0: created clone _Z1Bi.memprof.1
64-
; NOSKIP-RECUR-CALLSITES: memprof_recursive.cc:15:10: call in clone _Z1Bi.memprof.1 assigned to call function clone _Z1Ci.memprof.1
65-
;; We should only call the cold clone for the recursive context if we haven't
66-
;; enabled skipping of recursive contexts via -memprof-skip-recursive-contexts.
67-
; NOSKIP-RECUR-CONTEXTS: memprof_recursive.cc:19:13: call in clone main assigned to call function clone _Z1Bi.memprof.1
58+
; ALLOW-RECUR-CALLSITES: memprof_recursive.cc:4:0: created clone _Z1Dv.memprof.1
59+
; ALLOW-RECUR-CALLSITES: memprof_recursive.cc:5:10: call in clone _Z1Dv marked with memprof allocation attribute notcold
60+
; ALLOW-RECUR-CALLSITES: memprof_recursive.cc:5:10: call in clone _Z1Dv.memprof.1 marked with memprof allocation attribute cold
61+
; ALLOW-RECUR-CALLSITES: memprof_recursive.cc:8:0: created clone _Z1Ci.memprof.1
62+
; ALLOW-RECUR-CALLSITES: memprof_recursive.cc:10:12: call in clone _Z1Ci.memprof.1 assigned to call function clone _Z1Dv.memprof.1
63+
; ALLOW-RECUR-CALLSITES: memprof_recursive.cc:14:0: created clone _Z1Bi.memprof.1
64+
; ALLOW-RECUR-CALLSITES: memprof_recursive.cc:15:10: call in clone _Z1Bi.memprof.1 assigned to call function clone _Z1Ci.memprof.1
65+
;; We should only call the cold clone for the recursive context if we enabled
66+
;; recursive contexts via -memprof-allow-recursive-contexts=true (default).
67+
; ALLOW-RECUR-CONTEXTS: memprof_recursive.cc:19:13: call in clone main assigned to call function clone _Z1Bi.memprof.1
6868
; SKIP-RECUR-CONTEXTS-NOT: memprof_recursive.cc:19:13: call in clone main assigned to call function clone _Z1Bi.memprof.1
69-
; NOSKIP-RECUR-CALLSITES: memprof_recursive.cc:20:13: call in clone main assigned to call function clone _Z1Bi.memprof.1
69+
; ALLOW-RECUR-CALLSITES: memprof_recursive.cc:20:13: call in clone main assigned to call function clone _Z1Bi.memprof.1
7070

7171
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
7272
target triple = "x86_64-unknown-linux-gnu"

llvm/test/Transforms/MemProfContextDisambiguation/recursive.ll

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
; RUN: -pass-remarks=memprof-context-disambiguation \
4444
; RUN: %s -S 2>&1 | FileCheck %s \
4545
; RUN: --implicit-check-not "memprof_recursive3.cc:12:10: call in clone _Z1Ci.memprof.1 assigned" \
46-
; RUN: --check-prefix=ALL --check-prefix=NOSKIP-RECUR-CALLSITES --check-prefix=NOSKIP-RECUR-CONTEXTS
46+
; RUN: --check-prefix=ALL --check-prefix=ALLOW-RECUR-CALLSITES --check-prefix=ALLOW-RECUR-CONTEXTS
4747

4848
;; Skipping recursive callsites should result in no cloning.
4949
; RUN: opt -passes=memprof-context-disambiguation -supports-hot-cold-new \
@@ -62,28 +62,28 @@
6262
; RUN: opt -passes=memprof-context-disambiguation -supports-hot-cold-new \
6363
; RUN: -memprof-verify-ccg -memprof-verify-nodes \
6464
; RUN: -pass-remarks=memprof-context-disambiguation \
65-
; RUN: -memprof-skip-recursive-contexts \
65+
; RUN: -memprof-allow-recursive-contexts=false \
6666
; RUN: %s -S 2>&1 | FileCheck %s \
6767
; RUN: --implicit-check-not "memprof_recursive3.cc:12:10: call in clone _Z1Ci.memprof.1 assigned" \
68-
; RUN: --check-prefix=ALL --check-prefix=NOSKIP-RECUR-CALLSITES --check-prefix=SKIP-RECUR-CONTEXTS
68+
; RUN: --check-prefix=ALL --check-prefix=ALLOW-RECUR-CALLSITES --check-prefix=SKIP-RECUR-CONTEXTS
6969

70-
; NOSKIP-RECUR-CALLSITES: memprof_recursive.cc:4:0: created clone _Z1Dv.memprof.1
71-
; NOSKIP-RECUR-CALLSITES: memprof_recursive.cc:8:0: created clone _Z1Ci.memprof.1
72-
; NOSKIP-RECUR-CALLSITES: memprof_recursive.cc:14:0: created clone _Z1Bi.memprof.1
73-
; NOSKIP-RECUR-CALLSITES: memprof_recursive.cc:20:13: call in clone main assigned to call function clone _Z1Bi.memprof.1
74-
;; We should only call the cold clone for the recursive context if we haven't
75-
;; enabled skipping of recursive contexts via -memprof-skip-recursive-contexts.
76-
; NOSKIP-RECUR-CONTEXTS: memprof_recursive.cc:19:13: call in clone main assigned to call function clone _Z1Bi.memprof.1
77-
; NOSKIP-RECUR-CALLSITES: memprof_recursive.cc:15:10: call in clone _Z1Bi.memprof.1 assigned to call function clone _Z1Ci.memprof.1
78-
; NOSKIP-RECUR-CALLSITES: memprof_recursive.cc:10:12: call in clone _Z1Ci.memprof.1 assigned to call function clone _Z1Dv.memprof.1
79-
; NOSKIP-RECUR-CALLSITES: memprof_recursive.cc:5:10: call in clone _Z1Dv.memprof.1 marked with memprof allocation attribute cold
70+
; ALLOW-RECUR-CALLSITES: memprof_recursive.cc:4:0: created clone _Z1Dv.memprof.1
71+
; ALLOW-RECUR-CALLSITES: memprof_recursive.cc:8:0: created clone _Z1Ci.memprof.1
72+
; ALLOW-RECUR-CALLSITES: memprof_recursive.cc:14:0: created clone _Z1Bi.memprof.1
73+
; ALLOW-RECUR-CALLSITES: memprof_recursive.cc:20:13: call in clone main assigned to call function clone _Z1Bi.memprof.1
74+
;; We should only call the cold clone for the recursive context if we enabled
75+
;; recursive contexts via -memprof-allow-recursive-contexts=true (default).
76+
; ALLOW-RECUR-CONTEXTS: memprof_recursive.cc:19:13: call in clone main assigned to call function clone _Z1Bi.memprof.1
77+
; ALLOW-RECUR-CALLSITES: memprof_recursive.cc:15:10: call in clone _Z1Bi.memprof.1 assigned to call function clone _Z1Ci.memprof.1
78+
; ALLOW-RECUR-CALLSITES: memprof_recursive.cc:10:12: call in clone _Z1Ci.memprof.1 assigned to call function clone _Z1Dv.memprof.1
79+
; ALLOW-RECUR-CALLSITES: memprof_recursive.cc:5:10: call in clone _Z1Dv.memprof.1 marked with memprof allocation attribute cold
8080
;; We should call the original B for the recursive context if we have
81-
;; enabled skipping of recursive contexts via -memprof-skip-recursive-contexts.
81+
;; disabled recursive contexts via -memprof-allow-recursive-contexts=false.
8282
; SKIP-RECUR-CONTEXTS: memprof_recursive.cc:19:13: call in clone main assigned to call function clone _Z1Bi
83-
; NOSKIP-RECUR-CALLSITES: memprof_recursive.cc:12:10: call in clone _Z1Ci assigned to call function clone _Z1Bi
84-
; NOSKIP-RECUR-CALLSITES: memprof_recursive.cc:18:13: call in clone main assigned to call function clone _Z1Bi
85-
; NOSKIP-RECUR-CALLSITES: memprof_recursive.cc:15:10: call in clone _Z1Bi assigned to call function clone _Z1Ci
86-
; NOSKIP-RECUR-CALLSITES: memprof_recursive.cc:10:12: call in clone _Z1Ci assigned to call function clone _Z1Dv
83+
; ALLOW-RECUR-CALLSITES: memprof_recursive.cc:12:10: call in clone _Z1Ci assigned to call function clone _Z1Bi
84+
; ALLOW-RECUR-CALLSITES: memprof_recursive.cc:18:13: call in clone main assigned to call function clone _Z1Bi
85+
; ALLOW-RECUR-CALLSITES: memprof_recursive.cc:15:10: call in clone _Z1Bi assigned to call function clone _Z1Ci
86+
; ALLOW-RECUR-CALLSITES: memprof_recursive.cc:10:12: call in clone _Z1Ci assigned to call function clone _Z1Dv
8787
; ALL: memprof_recursive.cc:5:10: call in clone _Z1Dv marked with memprof allocation attribute notcold
8888

8989
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"

0 commit comments

Comments
 (0)