Skip to content

Add optimizer pass to avoid copies of variables no longer used #1960

@bbannier

Description

@bbannier

Most of them time when generating code we do not know whether a HILTI value will be used later and consequentially do not use std::move when emitting C++ code. This means that we might that we could e.g., needlessly create copies when calling functions which parameters pass by copy, or create copies when storing results in another variable.

The work in #1690 should gives us control flow information to decide whether a reference to a variable (a use of a hilti::ID referring to a variable) is the last use. If we persisted that information with e.g., the expression we could make use of it during C++ codegen.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions