Insert a llvm.experimental.noalias.scope.decl intrinsic that identifies where a noalias argument was inlined.
This patch includes some refactorings from D90104.
Paths
| Differential D93040
[InlineFunction] Use llvm.experimental.noalias.scope.decl for noalias arguments. ClosedPublic Authored by jeroen.dobbelaere on Dec 10 2020, 8:30 AM.
Details Summary Insert a llvm.experimental.noalias.scope.decl intrinsic that identifies where a noalias argument was inlined. This patch includes some refactorings from D90104.
Diff Detail
Event TimelineHerald added subscribers: dexonsmith, lxfind, hiraditya. · View Herald TranscriptDec 10 2020, 8:30 AM jeroen.dobbelaere added a child revision: D93042: [noalias.decl] Look through llvm.experimental.noalias.scope.decl.Dec 10 2020, 8:37 AM jeroen.dobbelaere added a parent revision: D93038: [NFC] clang/test/openMP/target_codegen.cpp should not depend on ssa name. jeroen.dobbelaere retitled this revision from [InlineFunction] Use llvm.noalias.decl for noalias arguments. to [InlineFunction] Use llvm.experimental.noalias.scope.decl for noalias arguments.. Comment ActionsRebased and adapted to changes to the intrinsic
jeroen.dobbelaere removed a child revision: D93042: [noalias.decl] Look through llvm.experimental.noalias.scope.decl.Jan 9 2021, 9:54 AM jeroen.dobbelaere added a parent revision: D93042: [noalias.decl] Look through llvm.experimental.noalias.scope.decl.
Comment Actions Thanks for the review ! I'll try to come with an update later today.
Comment Actions 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. jeroen.dobbelaere added a parent revision: D94978: [NFC] cleanup noalias2.ll test.Jan 19 2021, 9:20 AM Comment Actions LGTM. I would simplify the MetadataAsValue cloning a bit, but it's not particularly important either.
This revision is now accepted and ready to land.Jan 19 2021, 12:51 PM Comment Actions Adapted to comments. Simplified the cloning of the MetadataAsValue. Thanks @nikic for the fast and helpful reviews ! @jdoerfert, could you have an extra look at this one (and the follow ups) ? Thanks ! Comment Actions Ping @jdoerfert Do you want to check over this patch and the LoopUnroll/LoopRotate ones before they go in? Closed by commit rG2b9a834c43cb: [InlineFunction] Use llvm.experimental.noalias.scope.decl for noalias arguments. (authored by jeroen.dobbelaere). · Explain WhyJan 23 2021, 3:12 AM This revision was automatically updated to reflect the committed changes. Comment Actions
I assume this to be a secondary effect of having the instructions in the first place. Maybe some unroll or inline size threshold needs to be thought about them. At the end of the day, we might not be able to avoid something like this as we make !noalias correct, though, I imagine the threshold theory which can be resolved. Comment Actions
The loop unrolling/rotating and the cleanup patches are not yet committed. You can see the effect of those here: Also see D95141 for links to more results.
Revision Contents
Diff 318742 clang/test/CodeGen/aarch64-ls64.c
llvm/lib/Transforms/Utils/InlineFunction.cpp
llvm/test/Transforms/Coroutines/ArgAddr.ll
llvm/test/Transforms/Coroutines/coro-retcon-resume-values.ll
llvm/test/Transforms/Coroutines/coro-retcon-value.ll
llvm/test/Transforms/Coroutines/coro-retcon.ll
llvm/test/Transforms/Coroutines/ex2.ll
llvm/test/Transforms/Coroutines/ex3.ll
llvm/test/Transforms/Coroutines/ex4.ll
llvm/test/Transforms/Inline/launder.invariant.group.ll
llvm/test/Transforms/Inline/noalias-calls-always.ll
llvm/test/Transforms/Inline/noalias-calls.ll
llvm/test/Transforms/Inline/noalias-calls2.ll
llvm/test/Transforms/Inline/noalias-cs.ll
llvm/test/Transforms/Inline/noalias.ll
llvm/test/Transforms/Inline/noalias2.ll
llvm/test/Transforms/PhaseOrdering/inlining-alignment-assumptions.ll
llvm/test/Transforms/PhaseOrdering/instcombine-sroa-inttoptr.ll
llvm/test/Transforms/PhaseOrdering/pr39282.ll
|
The mention of unrolling here no longer makes sense.