Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@fabianschuiki
Copy link
Contributor

The Mem2Reg pass currently refuses to promote projections that have uses in different blocks. This is an unnecessary limitation, since the fact that a projection dominates a drive means that any operands of the projection, e.g. an array index, also dominate the drive. Therefore the drive can still be replaced with extract/inject operations using the projection operands. This only starts to become a problem once we allow projections to be passed as branch destination operands, which we do not.

Remove this unnecessary check, since it prevents some real-world use cases from being properly handled by mem2reg.

Copy link
Member

@maerhart maerhart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Base automatically changed from fschuiki/mem2reg-struct-extract to main August 15, 2025 17:04
The Mem2Reg pass currently refuses to promote projections that have uses
in different blocks. This is an unnecessary limitation, since the fact
that a projection dominates a drive means that any operands of the
projection, e.g. an array index, also dominate the drive. Therefore the
drive can still be replaced with extract/inject operations using the
projection operands. This only starts to become a problem once we allow
projections to be passed as branch destination operands, which we do
not.

Remove this unnecessary check, since it prevents some real-world use
cases from being properly handled by mem2reg.
@fabianschuiki fabianschuiki force-pushed the fschuiki/mem2reg-projection-blocks branch from 4e3b433 to ed191c9 Compare August 15, 2025 17:05
@fabianschuiki fabianschuiki merged commit 9f17a63 into main Aug 15, 2025
3 checks passed
@fabianschuiki fabianschuiki deleted the fschuiki/mem2reg-projection-blocks branch August 15, 2025 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants