Skip to content

Conversation

@OutOfCache
Copy link
Contributor

Not sure if this is the right approach. Open to other suggestions.

Sinking memory instructions is blocked in some cases by not wanting to separate a memory operations from the corresponding getelementptr since #96838.

We encountered a case where the getelementptr is in the entry block of a switch statement, while the loads are in the case blocks themselves. All of the case blocks are very similar and in theory sinkable, but since the geps are not part of the "sinkable instructions", we can't sink the majority of instructions into the merge block (see test cases).

This PR relaxes the criteria for the sinking, so it allows sinking of memory operands that are already separated from the geps.

However, I'll gladly hear any other suggestions for this situation!

@OutOfCache OutOfCache requested a review from nikic December 15, 2025 17:50
Future change will show how we can sink a memory operation,
which is already separated from a getelementptr in a differnt BB.
@github-actions
Copy link

github-actions bot commented Dec 15, 2025

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

Enable sinking of a memory operation, if it is separated from
the getelementptr in a different BB.
@OutOfCache OutOfCache force-pushed the simplifycfg-gep-sinking-diff-parents branch from d69ed8a to d0e0996 Compare December 16, 2025 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant