Closed
Description
I'm trying to figure out why certain iterator-based algorithms get const-optimized, while others don't and I stumbled upon this case.
example (updated 2021.03.05)
Compiling fn1
results in the expected machine code, but fn2
has extra stack reserve/free instructions that are not necessary, since the function's contents are optimized away completely. The stack size equals the size of the array.
Metadata
Metadata
Assignees
Labels
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: MIR optimizationsCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Issue: Problems and improvements with respect to performance of generated code.Relevant to the compiler team, which will review and decide on the PR/issue.