Just saw this in LLVM LangRef that I think can be used to implement restrict-like behavior for slice function parameters, without changing the function signature.
https://github.com/llvm/llvm-project/blob/9ffa02dbaa065dee20ab4d604a3eed042f0b3cc4/llvm/docs/LangRef.rst#L3188-L3190
So something like:
void foo(@restrict int[] a, @restrict int[] b) {
define void @void example.foo(int[], int[])({ i64, ptr } %a_arg, { i64, ptr } %b_arg) {
; Current prologue:
%a = alloca { i64, ptr }, align 8
%b = alloca { i64, ptr }, align 8
store { i64, ptr } %a_arg, ptr %a, align 8
store { i64, ptr } %b_arg, ptr %b, align 8
; NEW:
%a_ptr = getelementptr inbounds { i64, ptr }, ptr %a, i32 0, i32 1
%b_ptr = getelementptr inbounds { i64, ptr }, ptr %b, i32 0, i32 1
call void @llvm.assume(i1 true) ["separate_storage"(ptr %a_ptr, ptr %b_ptr)]
...
First step is to show with llc that indeed this result in the desired optimizations.
Just saw this in LLVM LangRef that I think can be used to implement restrict-like behavior for slice function parameters, without changing the function signature.
https://github.com/llvm/llvm-project/blob/9ffa02dbaa065dee20ab4d604a3eed042f0b3cc4/llvm/docs/LangRef.rst#L3188-L3190
So something like:
First step is to show with
llcthat indeed this result in the desired optimizations.