This is an archive of the discontinued LLVM Phabricator instance.

[PATCH 17/27] [noalias] Clone scopes and llvm.noalias.decl as needed during loop rotation.
Needs ReviewPublic

Authored by jeroen.dobbelaere on Oct 4 2019, 3:08 PM.

Details

Reviewers
hfinkel
jdoerfert
Summary

This is part of the series started by D68484.

When a restrict variable is declared in the loop body, and the loop is
rotated, care must be taken to clone the llvm.noalias.decl and the noalias
scopes to ensure that the local restrict scope does not spill over the
iterations.

Note: this is a stable point and tests should run fine with the patches applied up to this point.

Diff Detail

Event Timeline

jeroen.dobbelaere retitled this revision from [PATCH 28/38] [noalias] Clone scopes and llvm.noalias.decl as needed during loop rotation. to [PATCH 17/26] [noalias] Clone scopes and llvm.noalias.decl as needed during loop rotation..
jeroen.dobbelaere retitled this revision from [PATCH 17/26] [noalias] Clone scopes and llvm.noalias.decl as needed during loop rotation. to [PATCH 17/27] [noalias] Clone scopes and llvm.noalias.decl as needed during loop rotation..

Rebased to 9fb46a452d4e5666828c95610ceac8dcd9e4ce16 (September 7, 2020)

barannikov88 added inline comments.
llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
402
551

Compared to the (2) above, the U element has disappeared. Is it intended?

llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
551

Yes. in (2), U'' is already referring to a different iteration. It must be cloned, to make sure that it is treated different from load/stores that were hoisted outside the loop body (by a different pass). Those will still have the original 'D' dependency and 'U' related scope.

Of course, there is the situation that you have :

(1+2) ... { D U U } 
-> ... D' U' { U D U }
-> ... D' U' { D U D'' U '' }