llvm-project/llvm/test/ThinLTO/X86
Fangrui Song 4fbe33593c [LTO] Make local linkage GlobalValue in non-prevailing COMDAT available_externally
See the updated linkonce_resolution_comdat.ll. For a local linkage GV in a
non-prevailing COMDAT, it remains defined while its leader has been made
available_externally. This violates the COMDAT rule that its members must be
retained or discarded as a unit.

To fix this, update the regular LTO change D34803 to track local linkage
GlobalValues, and port the code to ThinLTO (GlobalAliases are not handled.)

Fix https://github.com/llvm/llvm-project/issues/58215:
as a size optimization, we place private `__profd_` in a COMDAT with a
`__profc_` key. When FuncImport.cpp makes `__profc_` available_externally due to
a non-prevailing COMDAT, `__profd_` incorrectly remains private. This change
makes the `__profd_` available_externally.

```
cat > c.h <<'eof'
extern void bar();
inline __attribute__((noinline)) void foo() {}
eof
cat > m1.cc <<'eof'
#include "c.h"
int main() {
  bar();
  foo();
}
eof
cat > m2.cc <<'eof'
#include "c.h"
__attribute__((noinline)) void bar() {
  foo();
}
eof

clang -O2 -fprofile-generate=./t m1.cc m2.cc -flto -fuse-ld=lld -o t_gen
rm -fr t && ./t_gen && llvm-profdata show -function=foo t/default_*.profraw
# one _Z3foov

clang -O2 -fprofile-generate=./t m1.cc m2.cc -flto=thin -fuse-ld=lld -o t_gen
rm -fr t && ./t_gen && llvm-profdata show -function=foo t/default_*.profraw
# one _Z3foov
```

Reviewed By: tejohnson

Differential Revision: https://reviews.llvm.org/D135427
2022-10-08 11:09:43 -07:00
..
Inputs [LTO] Make local linkage GlobalValue in non-prevailing COMDAT available_externally 2022-10-08 11:09:43 -07:00
DSOLocalEquivalent.ll [llvm] Change DSOLocalEquivalent type if the underlying global value type changes 2021-03-09 15:09:48 -08:00
alias-ifunc.ll [ThinLTO] Support aliased GlobalIFunc 2022-07-20 15:30:38 -07:00
alias_import.ll
alias_internal.ll
alias_resolution.ll
asm.ll [IRSymTab] Set FB_used on llvm.compiler.used symbols 2021-03-03 16:22:30 -08:00
autoupgrade.ll [IR] Enable opaque pointers by default 2022-06-02 09:40:56 +02:00
builtin-nostrip-aix.ll [IRSymTab] Mark __stack_chk_guard used 2021-10-28 11:22:26 -07:00
builtin-nostrip.ll [IRSymTab] Mark __stack_chk_guard used 2021-10-28 11:22:26 -07:00
cache-config.ll
cache-icall.ll
cache-import-lists.ll
cache-typeid-resolutions.ll
cache.ll [Support] [DebugInfo] Lazily create cache dir. 2022-01-20 19:27:15 +00:00
callees-metadata.ll
cfi-devirt.ll LTO: Decide upfront whether to use opaque/non-opaque pointer types 2022-06-01 18:05:53 -07:00
cfi-distributed.ll
cfi-icall-only-defuse.ll
cfi-icall.ll
cfi-unsat.ll LTO: Decide upfront whether to use opaque/non-opaque pointer types 2022-06-01 18:05:53 -07:00
cfi.ll [llvm-lto] Remove support for legacy pass manager 2022-04-11 09:40:17 +02:00
crash_debuginfo.ll [test] Change -function-import tests to use -passes= 2022-07-17 21:43:00 -07:00
deadstrip.ll [IR] Enable opaque pointers by default 2022-06-02 09:40:56 +02:00
debuginfo-compositetype-import.ll DebugInfo: Make the simplified template names prefix more unique 2022-04-06 18:25:46 +00:00
debuginfo-cu-import.ll
devirt-after-icp.ll LTO: Decide upfront whether to use opaque/non-opaque pointer types 2022-06-01 18:05:53 -07:00
devirt.ll [test] Remove unnecessary -verify-machineinstrs=0 2022-07-20 10:55:54 -07:00
devirt2.ll LTO: Decide upfront whether to use opaque/non-opaque pointer types 2022-06-01 18:05:53 -07:00
devirt_after_filtering_unreachable.ll Simplify WPD test case for hybrid LTO and thinTLO. 2021-12-21 17:23:42 +00:00
devirt_alias.ll
devirt_available_externally.ll
devirt_check.ll LTO: Decide upfront whether to use opaque/non-opaque pointer types 2022-06-01 18:05:53 -07:00
devirt_external_comdat_same_guid.ll [llvm-lto] Remove support for legacy pass manager 2022-04-11 09:40:17 +02:00
devirt_local_same_guid.ll [llvm-lto] Remove support for legacy pass manager 2022-04-11 09:40:17 +02:00
devirt_multiple_type_test.ll
devirt_promote.ll LTO: Decide upfront whether to use opaque/non-opaque pointer types 2022-06-01 18:05:53 -07:00
devirt_promote_legacy.ll
devirt_pure_virtual_base.ll [WPD] Fix handling of pure virtual base class 2021-02-23 16:07:09 -08:00
devirt_single_hybrid.ll LTO: Decide upfront whether to use opaque/non-opaque pointer types 2022-06-01 18:05:53 -07:00
devirt_vcall_vis_hidden.ll [test] Remove unnecessary -verify-machineinstrs=0 2022-07-20 10:55:54 -07:00
devirt_vcall_vis_public.ll [WPD] Use new llvm.public.type.test intrinsic for potentially publicly visible classes 2022-07-26 08:01:08 -07:00
diagnostic-handler-remarks-with-hotness.ll [Inline] Annotate inline pass name with link phase information for analysis. 2022-06-24 10:06:43 -07:00
diagnostic-handler-remarks.ll [Inline] Annotate inline pass name with link phase information for analysis. 2022-06-24 10:06:43 -07:00
dicompositetype-unique-alias.ll
dicompositetype-unique.ll
dicompositetype-unique2.ll
distributed_import.ll [test] Change -function-import tests to use -passes= 2022-07-17 21:43:00 -07:00
distributed_indexes.ll [ThinLTO] Fix bot failures 2021-09-23 18:00:48 -07:00
dontcall.ll Reland [clang] Rework dontcall attributes 2021-09-28 15:31:30 -07:00
dot-dumper-full-lto.ll
dot-dumper.ll [LTO] Ignore unreachable virtual functions in WPD in hybrid LTO. 2021-12-14 20:18:04 +00:00
dot-dumper2.ll [IR] Enable opaque pointers by default 2022-06-02 09:40:56 +02:00
drop-debug-info.ll
dsolocal_dllimport.ll
emit-inprocess-files.ll [ThinLTO][test] Add tests for emitting files in-process 2022-06-29 14:42:45 -07:00
emit_imports.ll [ThinLTO][test] Add tests for emitting files in-process 2022-06-29 14:42:45 -07:00
empty-module.ll [Verifier] Add verification logic for GlobalIFuncs 2021-10-31 20:00:57 -07:00
empty_module_with_cache.ll [Support] [DebugInfo] Lazily create cache dir. 2022-01-20 19:27:15 +00:00
export.ll
funcattrs-prop-exported-internal.ll [ThinLTO] Add noRecurse and noUnwind thinlink function attribute propagation 2021-09-27 12:28:07 -07:00
funcattrs-prop-maythrow.ll [LTO] Ignore unreachable virtual functions in WPD in hybrid LTO. 2021-12-14 20:18:04 +00:00
funcattrs-prop-undefined.ll [ThinLTO] Add noRecurse and noUnwind thinlink function attribute propagation 2021-09-27 12:28:07 -07:00
funcattrs-prop-unknown.ll LTO: Decide upfront whether to use opaque/non-opaque pointer types 2022-06-01 18:05:53 -07:00
funcattrs-prop-weak.ll [ThinLTO] Add noRecurse and noUnwind thinlink function attribute propagation 2021-09-27 12:28:07 -07:00
funcattrs-prop.ll [ThinLTO] Add noRecurse and noUnwind thinlink function attribute propagation 2021-09-27 12:28:07 -07:00
funcimport-debug.ll [IR] Enable opaque pointers by default 2022-06-02 09:40:56 +02:00
funcimport-stats.ll
funcimport-tbaa.ll
funcimport.ll
funcimport2.ll
funcimport_alwaysinline.ll [LTO] Ignore unreachable virtual functions in WPD in hybrid LTO. 2021-12-14 20:18:04 +00:00
function_entry_count.ll [ThinLTO] Add noRecurse and noUnwind thinlink function attribute propagation 2021-09-27 12:28:07 -07:00
globals-import-blockaddr.ll LTO: Decide upfront whether to use opaque/non-opaque pointer types 2022-06-01 18:05:53 -07:00
globals-import-const-fold.ll [IR] Enable opaque pointers by default 2022-06-02 09:40:56 +02:00
globals-import.ll
guid_collision.ll [test] Change -function-import tests to use -passes= 2022-07-17 21:43:00 -07:00
import-constant.ll LTO: Decide upfront whether to use opaque/non-opaque pointer types 2022-06-01 18:05:53 -07:00
import-dsolocal.ll [IR] Enable opaque pointers by default 2022-06-02 09:40:56 +02:00
import-metadata.ll
import-ro-constant.ll [IR] Enable opaque pointers by default 2022-06-02 09:40:56 +02:00
import-symver.ll [ThinLTO] Import symver directives for imported symbols (PR48214) 2020-12-02 14:56:43 +01:00
import_opaque_type.ll
index-const-prop-O0.ll
index-const-prop-alias.ll
index-const-prop-cache.ll
index-const-prop-comdat.ll [IR] Enable opaque pointers by default 2022-06-02 09:40:56 +02:00
index-const-prop-dead.ll
index-const-prop-full-lto.ll [IR] Enable opaque pointers by default 2022-06-02 09:40:56 +02:00
index-const-prop-gvref-pie.ll LTO: Decide upfront whether to use opaque/non-opaque pointer types 2022-06-01 18:05:53 -07:00
index-const-prop-gvref.ll LTO: Decide upfront whether to use opaque/non-opaque pointer types 2022-06-01 18:05:53 -07:00
index-const-prop-ldst.ll [IR] Enable opaque pointers by default 2022-06-02 09:40:56 +02:00
index-const-prop-linkage.ll LTO: Decide upfront whether to use opaque/non-opaque pointer types 2022-06-01 18:05:53 -07:00
index-const-prop.ll Preserve the lexical order for global variables during llvm-link merge 2021-04-26 10:11:34 -07:00
index-const-prop2.ll Preserve the lexical order for global variables during llvm-link merge 2021-04-26 10:11:34 -07:00
internalize.ll
lazyload_metadata.ll
linkonce_aliasee_ref_import.ll
linkonce_odr_unnamed_addr.ll [LTO] Initialize canAutoHide() using canBeOmittedFromSymbolTable() 2022-03-03 19:04:11 -05:00
linkonce_resolution_comdat.ll [LTO] Make local linkage GlobalValue in non-prevailing COMDAT available_externally 2022-10-08 11:09:43 -07:00
lit.local.cfg
llvm.used.ll
load-store-caching.ll [ThinLTO] Add Visibility bits to GlobalValueSummary::GVFlags 2021-01-27 10:43:51 -08:00
local_name_conflict.ll
local_name_conflict_var.ll
lower_type_test_phi.ll [WPD/LTT] Lower type test feeding assumes via phi correctly 2022-09-16 13:50:01 -07:00
mangled_symbol.ll
merge-triple.ll
module_asm2.ll
module_asm_glob.ll
module_summary_graph_traits.ll
newpm-basic.ll [llvm-lto] Remove support for legacy pass manager 2022-04-11 09:40:17 +02:00
nodevirt-nonpromoted-typeid.ll [llvm-lto] Remove support for legacy pass manager 2022-04-11 09:40:17 +02:00
noinline.ll
nossp.ll Don't override __attribute__((no_stack_protector)) by inlining (PR52886) 2022-01-13 12:04:49 +01:00
not-internalized.ll
personality-local.ll [IR] Enable opaque pointers by default 2022-06-02 09:40:56 +02:00
personality.ll
pr35472.ll
prefix_replace.ll
printer.ll [llvm-lto] Remove support for legacy pass manager 2022-04-11 09:40:17 +02:00
promote-local-name.ll Add switch to use "source_filename" instead of a hash ID for globally promoted local 2022-08-03 16:41:56 -07:00
pseudo-probe-desc-import.ll [PseudoProbe] Do not emit pseudo probes when module is not probed. 2022-03-25 12:59:53 -07:00
public-type-test.ll [WPD] Use new llvm.public.type.test intrinsic for potentially publicly visible classes 2022-07-26 08:01:08 -07:00
reference_non_importable.ll LTO: Decide upfront whether to use opaque/non-opaque pointer types 2022-06-01 18:05:53 -07:00
referenced_by_constant.ll [IR] Enable opaque pointers by default 2022-06-02 09:40:56 +02:00
save_objects.ll
section.ll
selective-save-temps.ll [LTO][ELF] Add selective --save-temps= option 2022-07-06 10:06:18 -07:00
strong_non_prevailing.ll
thinlto-internalize-doublepromoted.ll
thinlto-internalize-used.ll
tli-nobuiltin.ll
type_test_noindircall.ll [test] Remove unnecessary -verify-machineinstrs=0 2022-07-20 10:55:54 -07:00
visibility-elf.ll [ThinLTO] Add Visibility bits to GlobalValueSummary::GVFlags 2021-01-27 10:43:51 -08:00
visibility-macho.ll [ThinLTO] Add Visibility bits to GlobalValueSummary::GVFlags 2021-01-27 10:43:51 -08:00
weak_externals.ll LTO: Decide upfront whether to use opaque/non-opaque pointer types 2022-06-01 18:05:53 -07:00
weak_globals_import.ll [IR] Enable opaque pointers by default 2022-06-02 09:40:56 +02:00
weak_resolution.ll
weak_resolution_single.ll
writeonly-with-refs.ll [test] Change -function-import tests to use -passes= 2022-07-17 21:43:00 -07:00
writeonly.ll Preserve the lexical order for global variables during llvm-link merge 2021-04-26 10:11:34 -07:00
writeonly2.ll Preserve the lexical order for global variables during llvm-link merge 2021-04-26 10:11:34 -07:00