The argument promotion pass currently fails to copy function annotations over to the modified function after promoting arguments.
This patch copies the original function annotation to the new function.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/Transforms/IPO/ArgumentPromotion.cpp | ||
---|---|---|
220–222 | That should not be necessary anymore now that we copy all the metadata? One thing we need to keep in mind is that the original function may not be deleted and there are some kinds of metadata that need to be unique per function (.e.g !dbg), hence the F->setSubprogram(nullptr) below. With the change, it might be good to add a comment why we need to remove the !dbg metadata from the original function. But I am not aware of any other metadata nodes that have a similar constraint. |
llvm/lib/Transforms/IPO/ArgumentPromotion.cpp | ||
---|---|---|
220–222 | Good point. I'll drop this line and add the comment you suggested. |
LGTM, thanks! For the commit message, I think saying 'copy function metadata' instead of 'function annotations' is more accurate. Also there seems to be a stray : in the title.
That should not be necessary anymore now that we copy all the metadata?
One thing we need to keep in mind is that the original function may not be deleted and there are some kinds of metadata that need to be unique per function (.e.g !dbg), hence the F->setSubprogram(nullptr) below. With the change, it might be good to add a comment why we need to remove the !dbg metadata from the original function. But I am not aware of any other metadata nodes that have a similar constraint.