mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 06:44:46 +00:00
Refactor the optimisation for immediately-returned Let statements
The original intention was to avoid creating a local when we define and immediately return a primitive value. But now our default path does avoids unnecessary locals anyway! For StackMemory values we do need an optimised path but it's nicer to just pass a flag to Storage::allocate.
This commit is contained in:
parent
2daefc8b32
commit
1b97675f1f
3 changed files with 37 additions and 54 deletions
|
@ -133,7 +133,10 @@ pub struct CopyMemoryConfig {
|
|||
}
|
||||
|
||||
pub fn copy_memory(code_builder: &mut CodeBuilder, config: CopyMemoryConfig) {
|
||||
debug_assert!(config.from_ptr != config.to_ptr || config.from_offset != config.to_offset);
|
||||
if config.from_ptr == config.to_ptr && config.from_offset == config.to_offset {
|
||||
return;
|
||||
}
|
||||
|
||||
let alignment_flag = encode_alignment(config.alignment_bytes);
|
||||
let mut i = 0;
|
||||
while config.size - i >= 8 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue