-
Notifications
You must be signed in to change notification settings - Fork 14.4k
[SelectionDAG][RISCV] Avoid store merging across function calls #130430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 27 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
3e7e708
[SelectionDAG] Avoid store merging across function calls
mikhailramalho 5b1fc65
Check call_end instead of start
mikhailramalho be40ec2
Only walk over mem operation chains
mikhailramalho c3298ff
Don't go over NumConsecutiveStores
mikhailramalho b56d1b1
Use SDValues
mikhailramalho 82420c7
Added fallthrough
mikhailramalho 96c8e53
Add Visited list to cache the walk
mikhailramalho 3574370
Moved increment
mikhailramalho f9393d5
Updated test case
mikhailramalho d86ec01
Enable merge by default for scalars
mikhailramalho 04bca6d
Rewrite walk back algo to keep track of calls found
mikhailramalho f27092f
Check final type before we prevent merges
mikhailramalho 9faa629
No need to check operands. It's checked in the start of the loop
mikhailramalho b326da1
Assert operand type
mikhailramalho c858020
Moved peekThroughBitcasts into an assertion
mikhailramalho b6b1521
Use getChain instead of accessing the operand 0
mikhailramalho 18e68ea
Make hasCallInLdStChain a member function
mikhailramalho 3bc2b22
Added test case
mikhailramalho 816a235
Merge remote-tracking branch 'origin/main' into dag-spillcost-fix
mikhailramalho 904641f
Removed duplicated test after merge
mikhailramalho a255f16
No need to declare intrinsics anymore
mikhailramalho 75f4caa
Removed unused args
mikhailramalho de96633
Address comment
mikhailramalho 69c361c
Address comment
mikhailramalho 0dfd354
Removed todo
mikhailramalho e73c49d
Simplify interface
mikhailramalho a88e73b
Merge remote-tracking branch 'origin/main' into dag-spillcost-fix
mikhailramalho d6c848d
Remove assert that fails when building blender_r
mikhailramalho 0189f30
Address comment
mikhailramalho 99e11ae
Merge remote-tracking branch 'origin/main' into dag-spillcost-fix
mikhailramalho 67b3b65
Update test
mikhailramalho ed8a5fd
Removed todo
mikhailramalho 21ba7b2
Merge remote-tracking branch 'origin/main' into dag-spillcost-fix
mikhailramalho File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mikhailramalho marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about scalar FP?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think SrcVT can be a scalar FP and MergeVT can be a scalar integer VT. In that case it would still be ok to merge across the call.
Maybe this should be
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I glanced at what we do for this today. Quick summary:
2 x half (no zvfh) -> no merge performed
2 x half (zvfh) -> <2 x half> vector result type
2 x float -> <2 x float> vector result type
2 x float + noimplicitfloat --> two integer loads, no merge
So basically, I think the patch as it is should be a net improvement (by disabling case 2 and 3). I'm not opposed to your suggest change, just pointing out it's not needed to avoid a regression. (Edit: Except on re-read, it doesn't do that. FP is non scalar and vector is non scalar, which is equal with the current check. Yeah, we should do Craig's suggestion here.)
Note that the SDAG code doesn't even try to find a wider legal floating point type to merge to. The merge type will only be integer or vector.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mikhailramalho said the case he hit the assert on was 2 x float -> i64.
A wider legal FP doesn't really make sense. You can't really join them without going through integer.
I think either
!MergedVT.isVector() || SrcVT.isVector()
orMergedVT.isVector() == SrcVT.isVector()
would cover vector without picking up scalar FP in scalar integer. And allow the assert that was removed.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test cases (aside from the noimplicitfloat one) added in a5c7f81