Insert a llvm.experimental.noalias.scope.decl intrinsic that identifies where a noalias argument was inlined.
This patch includes some refactorings from D90104.
jeroen.dobbelaere on Dec 10 2020, 8:30 AM.Authored by
Thanks for the review ! I'll try to come with an update later today.
When working on a test with recursion and inlining, I was thinking about the differences between duplicating scopes in the unrolling (D92887) and duplicating the scopes during the inlining. The refactored code for the inlining keeps the same behavior as before and does a 'deep clone': all the MDNodes and there dependencies are cloned. So the scopes themselves become unique, but also the (function) domains to which they belong are duplicated.
In the utilities added for unrolling (D92887), only the scopes are duplicated. Their domains are kept. And that makes sense as the domain represents the function to which the scope belongs.
IMHO, it would make sense to not do the deep copy for inlining. The scope domain of the inlined function can be kept and shared by multiple functions and multiple inlines, as long as the scopes themselves are unique.
LGTM. I would simplify the MetadataAsValue cloning a bit, but it's not particularly important either.