Skip to content

Pass slices as not a struct, enable @restrict for T[] #4225

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

thewilsonator
Copy link
Contributor

@thewilsonator thewilsonator commented Sep 25, 2022

Exploring the idea of splitting T[] arguments into i(32|64), (T*|ptr) on the call level to enable adding @restrict to T[] arguments.

Currently (one among many) thing that fails is doesn't produce the correct alloca, it produces %a = alloca i64, align 8 and then only stores the length in a_arg_length. I can't seem to figure out where the code that produces the bad alloca comes from.

Still todo, runtime functions (_d_.*), test suite update, ABI, inlineIR, ...
Very much WIP.

Hmm, on second thoughts, it would be far less disruptive to do this only if @restrict is applied.

@thewilsonator thewilsonator changed the title Pass slices as not a struct Pass slices as not a struct, enable @restrict for T[] Sep 25, 2022
@JohanEngelen
Copy link
Member

I don't know if it is worth changing ABI for this. Another approach would be to add preamble code that reads from the argument with norestrict on the read operation? (into a dummy local variable that can then be used for the rest of the function codegen).

@JohanEngelen
Copy link
Member

@JohanEngelen
Copy link
Member

Did anyone ever ask about this issue on LLVM's maillist?

@thewilsonator
Copy link
Contributor Author

we can limit the ABI changes to just functions that take @restrict, but that would break function pointers...

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants