Page MenuHomePhabricator

[GlobalOpt] Never remove global values from non-discardable COMDATs
Needs ReviewPublic

Authored by Aaron1011 on Oct 12 2018, 8:33 PM.

Details

Reviewers
pcc
tejohnson
Summary

Currently, GlobalOpt will remove global values from non-discardable COMDATS (COMDATS which have at least one live object) if the value in question has local linkage.
As described in https://reviews.llvm.org/D53234, this is an invalid treatment of COMDAT members, and can lead to issues when using MD_Associated metadata.

I've modified GlobalOpt to always bail out of global value removal if the global value is in a non-discardable COMDAT.
I've also modified the associated test to check that one of its functions, which GlobalOpt currently removes due to its local linkage, is now kept.

Diff Detail