1
+ # Test the --dump-dot-func option with multiple functions
2
+ # (includes tests for both mangled/unmangled names)
3
+
4
+ RUN: %clang++ %p/Inputs/multi-func.cpp -o %t.exe -Wl,-q
5
+
6
+ # Test 1: --dump-dot-func with specific function name (mangled)
7
+ RUN: llvm-bolt %t.exe -o %t.bolt1 --dump-dot-func=_Z3addii -v=1 2>&1 | FileCheck %s --check-prefix=ADD
8
+
9
+ # Test 2: --dump-dot-func with regex pattern (main.*)
10
+ RUN: llvm-bolt %t.exe -o %t.bolt2 --dump-dot-func="main.*" -v=1 2>&1 | FileCheck %s --check-prefix=MAIN-REGEX
11
+
12
+ # Test 3: --dump-dot-func with multiple specific functions (mangled names)
13
+ RUN: llvm-bolt %t.exe -o %t.bolt3 --dump-dot-func=_Z3addii,_Z8multiplyii -v=1 2>&1 | FileCheck %s --check-prefix=MULTI
14
+
15
+ # Test 4: No option specified should create no dot files
16
+ RUN: llvm-bolt %t.exe -o %t.bolt4 2>&1 | FileCheck %s --check-prefix=NONE
17
+
18
+ # Test 5: --dump-dot-func with non-existent function
19
+ RUN: llvm-bolt %t.exe -o %t.bolt5 --dump-dot-func=nonexistent -v=1 2>&1 | FileCheck %s --check-prefix=NONEXISTENT
20
+
21
+ # Test 6: Backward compatibility - --dump-dot-all should still work
22
+ RUN: llvm-bolt %t.exe -o %t.bolt6 --dump-dot-all -v=1 2>&1 | FileCheck %s --check-prefix=ALL
23
+
24
+ # Test 7: Test with unmangled function name (main function)
25
+ RUN: llvm-bolt %t.exe -o %t.bolt7 --dump-dot-func=main -v=1 2>&1 | FileCheck %s --check-prefix=MAIN-UNMANGLED
26
+
27
+ # Check that specific functions are dumped
28
+ ADD: BOLT-INFO: dumping CFG to _Z3addii-00_build-cfg.dot
29
+ ADD-NOT: BOLT-INFO: dumping CFG to main-00_build-cfg.dot
30
+ ADD-NOT: BOLT-INFO: dumping CFG to _Z8multiplyii-00_build-cfg.dot
31
+ ADD-NOT: BOLT-INFO: dumping CFG to _Z11main_helperv-00_build-cfg.dot
32
+
33
+ MAIN-REGEX-DAG: BOLT-INFO: dumping CFG to main-00_build-cfg.dot
34
+ MAIN-REGEX-NOT: BOLT-INFO: dumping CFG to _Z3addii-00_build-cfg.dot
35
+ MAIN-REGEX-NOT: BOLT-INFO: dumping CFG to _Z8multiplyii-00_build-cfg.dot
36
+
37
+ MULTI-DAG: BOLT-INFO: dumping CFG to _Z3addii-00_build-cfg.dot
38
+ MULTI-DAG: BOLT-INFO: dumping CFG to _Z8multiplyii-00_build-cfg.dot
39
+ MULTI-NOT: BOLT-INFO: dumping CFG to main-00_build-cfg.dot
40
+ MULTI-NOT: BOLT-INFO: dumping CFG to _Z11main_helperv-00_build-cfg.dot
41
+
42
+ # Should be no dumping messages when no option is specified
43
+ NONE-NOT: BOLT-INFO: dumping CFG
44
+
45
+ # Should be no dumping messages for non-existent function
46
+ NONEXISTENT-NOT: BOLT-INFO: dumping CFG
47
+
48
+ ALL: BOLT-INFO: dumping CFG to main-00_build-cfg.dot
49
+
50
+ MAIN-UNMANGLED: BOLT-INFO: dumping CFG to main-00_build-cfg.dot
51
+ MAIN-UNMANGLED-NOT: BOLT-INFO: dumping CFG to _Z3addii-00_build-cfg.dot
52
+ MAIN-UNMANGLED-NOT: BOLT-INFO: dumping CFG to _Z8multiplyii-00_build-cfg.dot
0 commit comments