This is an archive of the discontinued LLVM Phabricator instance.

[DeadArgElim][ArgumentPromotion] Preserve MD_Associated metadata when re-creating function
Needs ReviewPublic

Authored by Aaron1011 on Oct 13 2018, 12:43 AM.

Details

Reviewers
lattner
chandlerc
Summary

Currently, DeadArgElim and ArgumentPromotion fail to preserve MD_Associated metadata pointing at the old function when a replacement function is created.
Since the replacement function is intended to be 'the same' as the old one (except for the changed arguments), any globals with MD_Associated metadata pointing to the old function should have it pointed at the new function.

I've added two helper functions to ModuleUtils which perform the metadata updating. It should be very easy to insert the proper calls to these functions into any other passes found to require the same logic.

Diff Detail

Event Timeline

Aaron1011 created this revision.Oct 13 2018, 12:43 AM

I accidentally excluded my test cases from the first patch

vsk added subscribers: davide, vsk.Oct 20 2018, 3:30 PM

Why not use RAUW to fix up any metadata which refers to a function?