This is an archive of the discontinued LLVM Phabricator instance.

Add Available Externally linkage type to isWeakForLinker()
ClosedPublic

Authored by mehdi_amini on Dec 7 2015, 8:58 PM.

Details

Summary

Per LangRef: "Globals with available_externally linkage are
allowed to be discarded at will, and are otherwise the same
as linkonce_odr", since linkonce_odr is in this list it makes
sense to have available_externally there as well.

Diff Detail

Event Timeline

mehdi_amini updated this revision to Diff 42136.Dec 7 2015, 8:58 PM
mehdi_amini retitled this revision from to Add Available Externally linkage type to isWeakForLinker().
mehdi_amini updated this object.
mehdi_amini added reviewers: rafael, echristo.
mehdi_amini added a subscriber: llvm-commits.
rafael accepted this revision.Dec 8 2015, 5:57 AM
rafael edited edge metadata.

LGTM

test/Transforms/GlobalOpt/available_externally_global_ctors.ll
18

Please clean up the test.

You don't need the comments, the #0, the alignment, etc.

This revision is now accepted and ready to land.Dec 8 2015, 5:57 AM
pcc added a subscriber: pcc.Dec 8 2015, 11:10 AM

I don't think this is right. It basically reverts part of D10941.

Should we instead fix globaldce to do the right thing with these types of globals?

We can fix whatever transformation is wrong because of that, but we first have to fix the LangRef...

pcc added a comment.Dec 8 2015, 11:30 AM

D15343 is the wording change for the LangRef.

Yes, sorry. I think my review was wrong.

It would be reasonable for isWeakForLinker to return true iff it
returned true for declarations, which is not the case.

Sorry,
Rafael