OpenMP: GC unused SIMD clones
authorSandra Loosemore <sandra@codesourcery.com>
Tue, 3 Jan 2023 17:46:02 +0000 (17:46 +0000)
committerSandra Loosemore <sandra@codesourcery.com>
Tue, 3 Jan 2023 17:49:23 +0000 (17:49 +0000)
commit0425ae780fb2b055d985b5719af5edfaaad5e980
tree147cec247d54aa4c199df4074534f686fd8b42c3
parent8fdef16cd5d1b89359db3cd9a9768ab2d1b5081f
OpenMP: GC unused SIMD clones

SIMD clones are created during the IPA phase when it is not known whether
or not the vectorizer can use them.  Clones for functions with external
linkage are part of the ABI, but local clones can be GC'ed if no calls are
found in the compilation unit after vectorization.

gcc/ChangeLog
* cgraph.h (struct cgraph_node): Add gc_candidate bit, modify
default constructor to initialize it.
* cgraphunit.cc (expand_all_functions): Save gc_candidate functions
for last and iterate to handle recursive calls.  Delete leftover
candidates at the end.
* omp-simd-clone.cc (simd_clone_create): Set gc_candidate bit
on local clones.
* tree-vect-stmts.cc (vectorizable_simd_clone_call): Clear
gc_candidate bit when a clone is used.

gcc/testsuite/ChangeLog
* g++.dg/gomp/target-simd-clone-1.C: Tweak to test
that the unused clone is GC'ed.
* gcc.dg/gomp/target-simd-clone-1.c: Likewise.
gcc/cgraph.h
gcc/cgraphunit.cc
gcc/omp-simd-clone.cc
gcc/testsuite/g++.dg/gomp/target-simd-clone-1.C
gcc/testsuite/gcc.dg/gomp/target-simd-clone-1.c
gcc/tree-vect-stmts.cc