Skip to content

Consider immutable references to be valid targets for mem2reg in more cases #12322

@jfecher

Description

@jfecher

Problem

Immutable references can't be mutated so we should be able to consider them as valid targets for mem2reg in more cases.

As long as we only consider immutable references allocated in the current function that are known not to be aliased (participate in only simple load/store instructions following the existing rules for mutable references), we should know these immutable references are not aliased and should be able to assume a call cannot change their value for example.

Happy Case

Expand the optimization opportunities for immutable references.

Workaround

None

Workaround Description

No response

Additional Context

No response

Project Impact

None

Blocker Context

No response

Would you like to submit a PR for this Issue?

None

Support Needs

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions