Imported functions and variables get the visibility from the prevailing module.
However, non-prevailing definitions do not get the visibility.
This patch adds visibility bits to GlobalValueSummary::GVFlags so thamodule. However, non-prevailing and prevailing definitions do not get
non-prevailing definitions can get the most constraining visibility from thethe visibility from the most constraining visibility among all modules.
This patch
* adds visibility bits to GlobalValueSummary::GVFlags
prevailing* (for ELF) computes the most constraining visibility among all definitions. ns and propagates it to all definitions
Protected/hidden can imply dso_local which can enable some optimizations (this
some optimizations (this is stronger than GVFlags::DSOLocal because the implied dso_local can be
dso_local can be leveraged for ELF -shared while default visibility dso_local has to be cleared
has to be cleared for ELF -shared).
Note: if a declaration has the most constraining visibilitythe visibility from a declaration is not tracked, the result
visibility may not be that one because we don't track visibility fromso if a declaration has
declarationsthe most constraining visibility, the result visibility may not be that one.