Skip to content

Commit 3055e86

Browse files
[MemProf] Disable cloning of callsites in recursive cycles by default (#122354)
This disables the support added in PR121985 by default while we investigate a compile time crash.
1 parent f53cb84 commit 3055e86

File tree

3 files changed

+33
-4
lines changed

3 files changed

+33
-4
lines changed

llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ static cl::opt<unsigned>
122122
cl::desc("Max depth to recursively search for missing "
123123
"frames through tail calls."));
124124

125-
// By default enable cloning of callsites involved with recursive cycles
125+
// Optionally enable cloning of callsites involved with recursive cycles
126126
static cl::opt<bool> AllowRecursiveCallsites(
127-
"memprof-allow-recursive-callsites", cl::init(true), cl::Hidden,
127+
"memprof-allow-recursive-callsites", cl::init(false), cl::Hidden,
128128
cl::desc("Allow cloning of callsites involved in recursive cycles"));
129129

130130
// When disabled, try to detect and prevent cloning of recursive contexts.

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

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
; RUN: opt -thinlto-bc %s >%t.o
77

8-
;; By default we should enable cloning of contexts involved with recursive
8+
;; Check behavior when we enable cloning of contexts involved with recursive
99
;; cycles, but not through the cycle itself. I.e. until full support for
1010
;; recursion is added, the cloned recursive call from C back to B (line 12) will
1111
;; not be updated to call a clone.
@@ -18,6 +18,7 @@
1818
; RUN: -r=%t.o,_Znam, \
1919
; RUN: -memprof-verify-ccg -memprof-verify-nodes \
2020
; RUN: -pass-remarks=memprof-context-disambiguation \
21+
; RUN: -memprof-allow-recursive-callsites=true \
2122
; RUN: -o %t.out 2>&1 | FileCheck %s \
2223
; RUN: --implicit-check-not "memprof_recursive3.cc:12:10: call in clone _Z1Ci.memprof.1 assigned" \
2324
; RUN: --check-prefix=ALLOW-RECUR-CALLSITES --check-prefix=ALLOW-RECUR-CONTEXTS
@@ -38,6 +39,21 @@
3839
; RUN: --implicit-check-not="created clone" \
3940
; RUN: --implicit-check-not="marked with memprof allocation attribute cold"
4041

42+
;; Check the default behavior (disabled recursive callsites).
43+
; RUN: llvm-lto2 run %t.o -enable-memprof-context-disambiguation \
44+
; RUN: -supports-hot-cold-new \
45+
; RUN: -r=%t.o,_Z1Dv,plx \
46+
; RUN: -r=%t.o,_Z1Ci,plx \
47+
; RUN: -r=%t.o,_Z1Bi,plx \
48+
; RUN: -r=%t.o,main,plx \
49+
; RUN: -r=%t.o,_Znam, \
50+
; RUN: -memprof-verify-ccg -memprof-verify-nodes \
51+
; RUN: -pass-remarks=memprof-context-disambiguation \
52+
; RUN: -o %t.out 2>&1 | FileCheck %s --allow-empty \
53+
; RUN: --implicit-check-not "memprof_recursive3.cc:12:10: call in clone _Z1Ci.memprof.1 assigned" \
54+
; RUN: --implicit-check-not="created clone" \
55+
; RUN: --implicit-check-not="marked with memprof allocation attribute cold"
56+
4157
;; Skipping recursive contexts should prevent spurious call to cloned version of
4258
;; B from the context starting at memprof_recursive.cc:19:13, which is actually
4359
;; recursive (until that support is added).
@@ -50,6 +66,7 @@
5066
; RUN: -r=%t.o,_Znam, \
5167
; RUN: -memprof-verify-ccg -memprof-verify-nodes \
5268
; RUN: -pass-remarks=memprof-context-disambiguation \
69+
; RUN: -memprof-allow-recursive-callsites=true \
5370
; RUN: -memprof-allow-recursive-contexts=false \
5471
; RUN: -o %t.out 2>&1 | FileCheck %s \
5572
; RUN: --implicit-check-not "memprof_recursive3.cc:12:10: call in clone _Z1Ci.memprof.1 assigned" \

llvm/test/Transforms/MemProfContextDisambiguation/recursive.ll

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,14 @@
3434
;;
3535
;; The IR was then reduced using llvm-reduce with the expected FileCheck input.
3636

37-
;; By default we should enable cloning of contexts involved with recursive
37+
;; Check behavior when we enable cloning of contexts involved with recursive
3838
;; cycles, but not through the cycle itself. I.e. until full support for
3939
;; recursion is added, the cloned recursive call from C back to B (line 12) will
4040
;; not be updated to call a clone.
4141
; RUN: opt -passes=memprof-context-disambiguation -supports-hot-cold-new \
4242
; RUN: -memprof-verify-ccg -memprof-verify-nodes \
4343
; RUN: -pass-remarks=memprof-context-disambiguation \
44+
; RUN: -memprof-allow-recursive-callsites=true \
4445
; RUN: %s -S 2>&1 | FileCheck %s \
4546
; RUN: --implicit-check-not "memprof_recursive3.cc:12:10: call in clone _Z1Ci.memprof.1 assigned" \
4647
; RUN: --check-prefix=ALL --check-prefix=ALLOW-RECUR-CALLSITES --check-prefix=ALLOW-RECUR-CONTEXTS
@@ -56,12 +57,23 @@
5657
; RUN: --implicit-check-not="marked with memprof allocation attribute cold" \
5758
; RUN: --check-prefix=ALL
5859

60+
;; Check the default behavior (disabled recursive callsites).
61+
; RUN: opt -passes=memprof-context-disambiguation -supports-hot-cold-new \
62+
; RUN: -memprof-verify-ccg -memprof-verify-nodes \
63+
; RUN: -pass-remarks=memprof-context-disambiguation \
64+
; RUN: %s -S 2>&1 | FileCheck %s \
65+
; RUN: --implicit-check-not "memprof_recursive3.cc:12:10: call in clone _Z1Ci.memprof.1 assigned" \
66+
; RUN: --implicit-check-not="created clone" \
67+
; RUN: --implicit-check-not="marked with memprof allocation attribute cold" \
68+
; RUN: --check-prefix=ALL
69+
5970
;; Skipping recursive contexts should prevent spurious call to cloned version of
6071
;; B from the context starting at memprof_recursive.cc:19:13, which is actually
6172
;; recursive (until that support is added).
6273
; RUN: opt -passes=memprof-context-disambiguation -supports-hot-cold-new \
6374
; RUN: -memprof-verify-ccg -memprof-verify-nodes \
6475
; RUN: -pass-remarks=memprof-context-disambiguation \
76+
; RUN: -memprof-allow-recursive-callsites=true \
6577
; RUN: -memprof-allow-recursive-contexts=false \
6678
; RUN: %s -S 2>&1 | FileCheck %s \
6779
; RUN: --implicit-check-not "memprof_recursive3.cc:12:10: call in clone _Z1Ci.memprof.1 assigned" \

0 commit comments

Comments
 (0)