Skip to content

Conversation

@lucas-rami
Copy link
Contributor

This introduces a Rematerializer class that identifies register rematerialization opportunities within a machine function and provides an API to easily perform those rematerializations with a high level of control. Its key feature is its ability to model relationships between rematerializable registers and rematerialize arbitrarily complex groups of registers at once to specific locations. The class comment describes the underlying model in details.

This includes unit tests for the class to both verify its correct behavior and showcase its current rematerialization capabilities.

This hopefully can be a step toward addressing long-standing rematerialization limitations in LLVM backends. In the future, the goal is to pair this support with generic or target-dependent strategies for picking the best rematerialization opportunities to perform to achieve some kind of objective (e.g., a specific register pressure target in scheduling regions). As a concrete example, I intend to use this in the AMDGPU scheduler to help in reducing spilling and/or increasing occupancy in kernels.

@github-actions
Copy link

github-actions bot commented Jan 21, 2026

✅ With the latest revision this PR passed the C/C++ code formatter.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant