Skip to content

Landing the MIR move elimination optimization #63

Description

@Amanieu

Duration: 1h

Description:

RFC: rust-lang/rfcs#3943
Project goal: rust-lang/goals#396

The prototype implementation at rust-lang/rust#156046 shows promising results, with a 2-7% speedup on the compiler itself. However landing it is challenging because it changes the semantics of some MIR operations.

The session will start with an overview of the optimization and then dive into the potentially contentious topics:

  • Assignments now allow overlapping source and destination as long as they are from different allocations.
  • Moves of a whole local now effectively act as a StorageDead, meaning that any access to it is UB after the move (e.g. via raw pointers).
  • The pass uses a liveness analysis that requires StorageDead on unwind paths to determine whether 2 locals are allowed to share the same address. These need to be preserved through most of the mir-opt pipeline.
  • The pass deletes all storage statements and re-construct them from scratch from liveness information.
  • Is DSE allowed to shrink the live range of locals?
  • Impact on debuginfo statements (which only support a Local instead of a Place for the destination).
  • How the coroutine pass can take advantage of this optimization for smaller coroutines.

This session is of interest to @rust-lang/wg-mir-opt and @tmandry (for the impact on the coroutine transform).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions