This is an archive of the discontinued LLVM Phabricator instance.

[Bugpoint] Erase comdat annotations after removing a global's initializer.
ClosedPublic

Authored by jlebar on Jun 12 2016, 8:04 PM.

Details

Summary

This is necessary to keep the verifier happy after bugpoint removes an
initializer from a global variable with a comdat annotation, because
globals without initializers may not have comdats.

Diff Detail

Repository
rL LLVM

Event Timeline

jlebar updated this revision to Diff 60485.Jun 12 2016, 8:04 PM
jlebar retitled this revision from to [Bugpoint] Erase comdat annotations after removing a global's initializer..
jlebar updated this object.
jlebar added reviewers: majnemer, rnk.
jlebar added a subscriber: llvm-commits.
majnemer edited edge metadata.Jun 12 2016, 8:55 PM

Do we need the same code in DeleteFunctionBody?

Do we need the same code in DeleteFunctionBody?

Hm, I am not sure; I guess you're saying it's illegal to have a comdat annotation on a function declaration? It may only be present on a definition? But then, if we delete it on the declaration, do we also need to delete it on the corresponding global variable?

Do we need the same code in DeleteFunctionBody?

Hm, I am not sure; I guess you're saying it's illegal to have a comdat annotation on a function declaration? It may only be present on a definition? But then, if we delete it on the declaration, do we also need to delete it on the corresponding global variable?

COMDATs are only valid on definitions.

jlebar updated this revision to Diff 60544.Jun 13 2016, 9:21 AM
jlebar edited edge metadata.

Also delete comdats when turning function defs into decls.

majnemer accepted this revision.Jun 13 2016, 9:45 AM
majnemer edited edge metadata.

LGTM

This revision is now accepted and ready to land.Jun 13 2016, 9:45 AM
This revision was automatically updated to reflect the committed changes.