This is an archive of the discontinued LLVM Phabricator instance.

[PATCH 18/27] [noalias] Introduce PropagateAndConvertNoAlias pass
Needs ReviewPublic

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

Details

Summary

This is part of the series started by D68484.

This pass moves llvm.noalias intrinsics to the ptr_provenance path of
load/store instructions. At the same time, they are converted into
llvm.provenance.noalias intrinsics. For llvm.noalias intrinsics that are
returned or passed as arguments, a llvm.noalias.arg.guard is introduced,
combining the pointer path and the ptr_provenance path.

This migration allows other optimization passes to do changes on the
normal pointer path, without impacting the ptr_provenance path that
contains the restrict/noalias related information.

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 marked an inline comment as done.Feb 20 2020, 6:37 AM
jeroen.dobbelaere added inline comments.
llvm/lib/Transforms/Scalar/PropagateAndConvertNoAlias.cpp
780

A testcase from Alexey, triggers this FIXME (see http://lists.llvm.org/pipermail/llvm-dev/2020-February/139358.html)

We should do the same here as in lines 810-835, but on Operand 0.

As this is the third time we have this kind of code, it should also be refactored out.

jeroen.dobbelaere marked an inline comment as not done.Feb 20 2020, 6:38 AM
jeroen.dobbelaere added a subscriber: alexey.zhikhar.

This update adds 'llvm.noalias.arg.guard' to noalias pointers that are stored to memory. This ensures that the noalias relationship is not lost when the stores are optimized away later on.

Thanks to @alexey.zhikhar for reporting this problem.

jeroen.dobbelaere retitled this revision from [PATCH 29/38] [noalias] Introduce PropagateAndConvertNoAlias pass to [PATCH 18/26] [noalias] Introduce PropagateAndConvertNoAlias pass.
jeroen.dobbelaere edited the summary of this revision. (Show Details)
jeroen.dobbelaere retitled this revision from [PATCH 18/26] [noalias] Introduce PropagateAndConvertNoAlias pass to [PATCH 18/27] [noalias] Introduce PropagateAndConvertNoAlias pass.

Rebased to 9fb46a452d4e5666828c95610ceac8dcd9e4ce16 (September 7, 2020)

Fix testcase where ptr_provenance type and ptr type were different.