|
1 | 1 | ; RUN: rm -rf %t && mkdir %t && cd %t |
2 | 2 |
|
3 | | -; Tests that devirtualization is suppressed on a class when its compatible |
4 | | -; class could be referenced from dynamic linker that is not visible to the |
5 | | -; linker. |
| 3 | +; Tests that devirtualization is suppressed on a class when the LTO unit doesn't |
| 4 | +; have the prevailing definition of the class. |
6 | 5 |
|
7 | 6 | ; Generate unsplit module with summary for ThinLTO index-based WPD. |
8 | 7 | ; RUN: opt -thinlto-bc -o summary.o %s |
9 | 8 |
|
10 | 9 | ; Index based WPD |
11 | | -; For `_ZTI7Derived`, the 'llvm-lto2' resolution arguments specifies `VisibleOutsideSummary` as false |
12 | | -; and `ExportDynamic` as false. The callsite inside @_ZN4Base8dispatchEv |
13 | | -; got devirtualized. |
| 10 | +; The callsite inside @_ZN4Base8dispatchEv gets devirtualized when symbol |
| 11 | +; resolution shows there is a prevailing definition of `_ZTI7Derived` in the |
| 12 | +; LTO unit. |
14 | 13 | ; RUN: llvm-lto2 run summary.o -save-temps -pass-remarks=. \ |
| 14 | +; RUN: -thinlto-threads=1 \ |
15 | 15 | ; RUN: -o tmp \ |
16 | 16 | ; RUN: --whole-program-visibility-enabled-in-lto=true \ |
17 | 17 | ; RUN: --validate-all-vtables-have-type-infos=true \ |
|
24 | 24 | ; RUN: -r=summary.o,_ZTV8DerivedN,p \ |
25 | 25 | ; RUN: -r=summary.o,_ZTI8DerivedN,p \ |
26 | 26 | ; RUN: -r=summary.o,_ZTS8DerivedN,p \ |
27 | | -; RUN: -r=summary.o,_ZTI7Derived, \ |
| 27 | +; RUN: -r=summary.o,_ZTI7Derived,p \ |
28 | 28 | ; RUN: 2>&1 | FileCheck --allow-empty %s --check-prefix=REMARK |
29 | 29 |
|
30 | 30 |
|
31 | 31 | ; Index based WPD |
32 | | -; For `_ZTI7Derived`, the 'llvm-lto2' resolution arguments specifies `VisibleOutsideSummary` as false |
33 | | -; and `ExportDynamic` as true. The callsite inside @_ZN4Base8dispatchEv won't |
34 | | -; get devirtualized. |
| 32 | +; The callsite inside @_ZN4Base8dispatchEv remains indirect and not de-virtualized |
| 33 | +; when symbol resolution shows there isn't a prevailing definition of |
| 34 | +; `_ZTI7Derived` in the LTO unit. |
35 | 35 | ; RUN: llvm-lto2 run summary.o -save-temps -pass-remarks=. \ |
| 36 | +; RUN: -thinlto-threads=1 \ |
36 | 37 | ; RUN: -o tmp \ |
37 | 38 | ; RUN: --whole-program-visibility-enabled-in-lto=true \ |
38 | 39 | ; RUN: --validate-all-vtables-have-type-infos=true \ |
|
45 | 46 | ; RUN: -r=summary.o,_ZTV8DerivedN,p \ |
46 | 47 | ; RUN: -r=summary.o,_ZTI8DerivedN,p \ |
47 | 48 | ; RUN: -r=summary.o,_ZTS8DerivedN,p \ |
48 | | -; RUN: -r=summary.o,_ZTI7Derived,d \ |
| 49 | +; RUN: -r=summary.o,_ZTI7Derived, \ |
49 | 50 | ; RUN: 2>&1 | FileCheck %s --allow-empty --implicit-check-not='single-impl: devirtualized a call to' |
50 | 51 |
|
51 | | - |
52 | | -; Hybrid LTO WPD |
| 52 | +; Repeat the above tests for WPD in hybrid LTO. |
53 | 53 | ; RUN: opt --thinlto-bc --thinlto-split-lto-unit -o hybrid.o %s |
| 54 | + |
54 | 55 | ; RUN: llvm-lto2 run hybrid.o -save-temps -pass-remarks=. \ |
| 56 | +; RUN: -thinlto-threads=1 \ |
55 | 57 | ; RUN: -o hybrid \ |
56 | 58 | ; RUN: --whole-program-visibility-enabled-in-lto=true \ |
57 | 59 | ; RUN: --validate-all-vtables-have-type-infos=true \ |
|
61 | 63 | ; RUN: -r=hybrid.o,_ZN4Base8dispatchEv,px \ |
62 | 64 | ; RUN: -r=hybrid.o,_ZN7DerivedC2Ev, \ |
63 | 65 | ; RUN: -r=hybrid.o,_ZN8DerivedN5printEv,px \ |
64 | | -; RUN: -r=hybrid.o,_ZTV8DerivedN,p \ |
65 | | -; RUN: -r=hybrid.o,_ZTI8DerivedN,p \ |
| 66 | +; RUN: -r=hybrid.o,_ZTV8DerivedN, \ |
| 67 | +; RUN: -r=hybrid.o,_ZTI8DerivedN, \ |
66 | 68 | ; RUN: -r=hybrid.o,_ZTS8DerivedN,p \ |
67 | | -; RUN: -r=hybrid.o,_ZTI7Derived, \ |
68 | | -; RUN: -r=hybrid.o,_ZN8DerivedN5printEv,px \ |
| 69 | +; RUN: -r=hybrid.o,_ZTI7Derived,p \ |
| 70 | +; RUN: -r=hybrid.o,_ZN8DerivedN5printEv, \ |
69 | 71 | ; RUN: -r=hybrid.o,_ZTV8DerivedN,p \ |
70 | 72 | ; RUN: -r=hybrid.o,_ZTI8DerivedN,p \ |
71 | 73 | ; RUN: 2>&1 | FileCheck --allow-empty %s --check-prefix=REMARK |
72 | 74 |
|
73 | | -; Hybrid LTO WPD |
| 75 | + |
74 | 76 | ; RUN: llvm-lto2 run hybrid.o -save-temps -pass-remarks=. \ |
| 77 | +; RUN: -thinlto-threads=1 \ |
75 | 78 | ; RUN: -o hybrid \ |
76 | 79 | ; RUN: --whole-program-visibility-enabled-in-lto=true \ |
77 | 80 | ; RUN: --validate-all-vtables-have-type-infos=true \ |
|
81 | 84 | ; RUN: -r=hybrid.o,_ZN4Base8dispatchEv,px \ |
82 | 85 | ; RUN: -r=hybrid.o,_ZN7DerivedC2Ev, \ |
83 | 86 | ; RUN: -r=hybrid.o,_ZN8DerivedN5printEv,px \ |
84 | | -; RUN: -r=hybrid.o,_ZTV8DerivedN,p \ |
85 | | -; RUN: -r=hybrid.o,_ZTI8DerivedN,p \ |
| 87 | +; RUN: -r=hybrid.o,_ZTV8DerivedN, \ |
| 88 | +; RUN: -r=hybrid.o,_ZTI8DerivedN, \ |
86 | 89 | ; RUN: -r=hybrid.o,_ZTS8DerivedN,p \ |
87 | | -; RUN: -r=hybrid.o,_ZTI7Derived,d \ |
88 | | -; RUN: -r=hybrid.o,_ZN8DerivedN5printEv,px \ |
| 90 | +; RUN: -r=hybrid.o,_ZTI7Derived, \ |
| 91 | +; RUN: -r=hybrid.o,_ZN8DerivedN5printEv, \ |
89 | 92 | ; RUN: -r=hybrid.o,_ZTV8DerivedN,p \ |
90 | 93 | ; RUN: -r=hybrid.o,_ZTI8DerivedN,p \ |
91 | 94 | ; RUN: 2>&1 | FileCheck --allow-empty %s --implicit-check-not='single-impl: devirtualized a call to' |
|
0 commit comments