This is an archive of the discontinued LLVM Phabricator instance.

[llvm] Add CloneModuleInto to clone a Module into another one, a la assignment
AbandonedPublic

Authored by hintonda on May 4 2019, 2:34 PM.

Details

Reviewers
pcc
lattner
beanz
Summary

The Module class contains an LLVMContext& member, which
prevents assignment. This technique uses placement new and passed the
new instance to the existing CloneModule functions to accomplish the
same thing.

This is useful in passes that want to clone the Module, prospectively
modify it, then decide whether or not to keep the changes, e.g.,
bugpoint type reduction passes.

Event Timeline

hintonda created this revision.May 4 2019, 2:34 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 4 2019, 2:34 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
hintonda updated this revision to Diff 200284.May 20 2019, 8:01 AM

Rebase only...

hintonda abandoned this revision.Jun 15 2019, 11:19 AM