[LoopUnroll] Use llvm.experimental.noalias.scope.decl for duplicating noalias metadat...
authorJeroen Dobbelaere <jeroen.dobbelaere@synopsys.com>
Sun, 24 Jan 2021 12:48:20 +0000 (13:48 +0100)
committerJeroen Dobbelaere <jeroen.dobbelaere@synopsys.com>
Sun, 24 Jan 2021 12:48:20 +0000 (13:48 +0100)
commit774629641bf32503353a179e98aaa3ef055d6870
tree01e9a6644cebab6788f89219c1104344b70af733
parentb3d7e761e347d562333893652dcf3837fa55d777
[LoopUnroll] Use llvm.experimental.noalias.scope.decl for duplicating noalias metadata as needed

This is a fix for https://bugs.llvm.org/show_bug.cgi?id=39282. Compared to D90104, this version is based on part of the full restrict patched (D68484) and uses the `@llvm.experimental.noalias.scope.decl` intrinsic to track the location where !noalias and !alias.scope scopes have been introduced. This allows us to only duplicate the scopes that are really needed.

Notes:
- it also includes changes and tests from D90104

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D92887
llvm/include/llvm/IR/Metadata.h
llvm/include/llvm/Transforms/Utils/Cloning.h
llvm/lib/Transforms/Utils/CloneFunction.cpp
llvm/lib/Transforms/Utils/LoopUnroll.cpp
llvm/test/Transforms/LoopUnroll/noalias.ll [new file with mode: 0644]
llvm/test/Transforms/PhaseOrdering/pr39282.ll