This patch is the first of a series that introduces full restrict support
in LLVM and clang. The full support is based on the original local restrict
patches from Hal Finkel and is an implementation of the
'RFC: Full 'restrict' support in LLVM' [1].
In order to show the dependencies, in what follows, most of the time
a non-functional rebased patch from Hal Finkel is provided, followed
by a patch that enhances the full restrict support and makes everything
compile and run again.
[1] https://lists.llvm.org/pipermail/llvm-dev/2019-October/135672.html
Notes:
- The mechanism with the ptr_provenance is such that passes that don't know about it will either work (and maybe miss certain optimizations) or crash. This is considered to be better than producing wrong code.
- This set of patches is at the moment not complete. It is tested and works for the use cases of my company. But it is to be expected that some optimization passes will not interact well with it. In our experience, a number of optimization passes do have problems with the optional extra argument for load and store instructions, and they are normally easy to fix. It is possible that we did not yet catch all of those in passes that we don't use.
- One item that is known to be missing, is LLVM IR bitcode support for the noalias_sidechannel of the load/store instruction (ascii LLVM IR is supported).
- The new pass manager support has been fixed (D68507).
- SLPVectorizer issues also have been fixed. (D68517)
- The options enabling/disabling full restrict have been improved. (D68484)
- A latent problem where invalid llvm-ir was produced during inlining has been fixed. (D68509)
- A bug were the noalias depends-on relationship was lost has been fixed. (D68512 and D68521)
Added with the drop of 2020/06/12:
- Renaming of 'side channel' to provenance, ptr_provenance
- Incorporating Hal Finkel's changes. This should make it easier to review. It also reduces the number of patches to 26.
- Handling of llvm.noalias.copy.guard during SROA has been improved.
- Handling of Loop Unrolling has been improved.
- Fixed a case in -fno-full-restrict where the new annotations were still produced.
Added with the drop of 2020/09/07
- llvm-IR bitcode support
- DeadArgumentElimination support
Added with the drop of 2021/05/18
- coexists with llvm.experimental.noalias.scope.decl
- some small improvements/fixes
Notes:
- NoAliasInfo.rst describes the noalias intrinsics infrastructure.
This set of patches is based on f8dbd61074176bae92ec360a093ac7bc498c9321 (May 18, 2021)
A convenience patch is available at D69542.
Nit:
The "of" sounds weird to me.
I personally dislike sentences like this and would just remove it.
Arguably that is always true. The section describes the semantics of the alias stuff and how that can be used to model restrict. It is implied that other things can be modeled as well.