This is an archive of the discontinued LLVM Phabricator instance.

Don't merge global constants with non-dbg metadata.
ClosedPublic

Authored by eugenis on Mar 7 2017, 5:06 PM.

Details

Reviewers
pcc
Summary

!type metadata can not be dropped. An alternative to this is adding
!type metadata from the replaced globals to the replacement, but that
may weaken type tests and make them slower at the same time.

The merged global gets !dbg metadata from replaced globals, and can
end up with multiple debug locations

Diff Detail

Repository
rL LLVM

Event Timeline

eugenis created this revision.Mar 7 2017, 5:06 PM
eugenis edited the summary of this revision. (Show Details)
pcc edited edge metadata.Mar 7 2017, 5:16 PM

I think there is a pre-existing bug in this pass in that it can effectively *add* metadata to a global (by replacing references to a global without metadata with references to a global with metadata). Can you fix both issues at once by refusing to merge if either global has any metadata at all?

eugenis updated this revision to Diff 90977.Mar 7 2017, 6:33 PM
eugenis retitled this revision from Don't merge global constants with !type to Don't merge global constants with non-dbg metadata..
eugenis edited the summary of this revision. (Show Details)
pcc accepted this revision.Mar 8 2017, 2:34 PM

LGTM

This revision is now accepted and ready to land.Mar 8 2017, 2:34 PM