Skip to content

Unnecessary instructions generated #75978

Closed
@bugadani

Description

@bugadani

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

A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.A-mir-optArea: MIR optimizationsE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.I-slowIssue: Problems and improvements with respect to performance of generated code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions