[SimplifyCFG] Enable sinking of memory operands with separated geps #172342
+162
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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!