-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Currently, air supports any type (including aggregates) as temporaries. Codegen lowers all aggregates to the stack, which results in some redundant intermediates being created.
For example, the code let mut slice = array[start..end] creates two allocas: the first one is the temporary to store the slicing result of array[start..end], and the second is the mutable stack slot for the slice variable. The backend then generates a copy (unrolled gep + load + store for slices, memcpy for arrays) between the two allocas. This problem doesn't currently happen when slice is constant, because no stack slot is created. However, for mut slices, we should find a way to elide the copy, and intialize the rvalue directly into the mut variable.
Metadata
Metadata
Assignees
Labels
No labels