-
Notifications
You must be signed in to change notification settings - Fork 17.6k
[DAGCombiner] Fix crash in reassociationCanBreakAddressingModePattern for multi-memop nodes #180268
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 3 commits
Commits
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
32 changes: 32 additions & 0 deletions
32
llvm/test/CodeGen/AMDGPU/dagcombine-reassociate-multi-memop.ll
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx950 < %s | FileCheck %s | ||
|
|
||
| ; Test that DAGCombiner::reassociationCanBreakAddressingModePattern does not | ||
| ; crash when a MemSDNode user has multiple memory operands (e.g. | ||
| ; buffer_load_lds which reads from a buffer and writes to LDS). | ||
|
|
||
| @global_smem = external addrspace(3) global [0 x i8], align 16 | ||
|
|
||
| declare ptr addrspace(8) @llvm.amdgcn.make.buffer.rsrc.p8.p1(ptr addrspace(1), i16, i64, i32) | ||
| declare void @llvm.amdgcn.raw.ptr.buffer.load.lds(ptr addrspace(8), ptr addrspace(3) nocapture, i32, i32, i32, i32, i32) | ||
| declare i32 @llvm.amdgcn.workitem.id.x() | ||
|
|
||
| ; CHECK-LABEL: buffer_load_lds_reassociate_offsets: | ||
| ; CHECK: buffer_load_dwordx4 v{{[0-9]+}}, s{{\[[0-9]+:[0-9]+\]}}, 0 offen lds | ||
| ; CHECK: buffer_load_dwordx4 v{{[0-9]+}}, s{{\[[0-9]+:[0-9]+\]}}, 0 offen lds | ||
| define amdgpu_kernel void @buffer_load_lds_reassociate_offsets(ptr addrspace(1) inreg %ptr) { | ||
| %tid = call i32 @llvm.amdgcn.workitem.id.x() | ||
| ; Create a pattern that will be reassociated: (add (add base, 1024), 32) | ||
| ; where base comes from mul, creating nested adds | ||
| %base = mul i32 %tid, 1536 | ||
| %add1 = add i32 %base, 1024 | ||
| %offset1 = add i32 %add1, 32 | ||
| %offset2 = add i32 %add1, 33 | ||
| %shl1 = shl i32 %offset1, 1 | ||
| %shl2 = shl i32 %offset2, 1 | ||
| %rsrc = call ptr addrspace(8) @llvm.amdgcn.make.buffer.rsrc.p8.p1(ptr addrspace(1) %ptr, i16 0, i64 2147483646, i32 159744) | ||
| %lds0 = getelementptr inbounds i8, ptr addrspace(3) @global_smem, i32 0 | ||
| %lds1 = getelementptr inbounds i8, ptr addrspace(3) @global_smem, i32 1056 | ||
| call void @llvm.amdgcn.raw.ptr.buffer.load.lds(ptr addrspace(8) %rsrc, ptr addrspace(3) %lds0, i32 16, i32 %shl1, i32 0, i32 0, i32 0) | ||
| call void @llvm.amdgcn.raw.ptr.buffer.load.lds(ptr addrspace(8) %rsrc, ptr addrspace(3) %lds1, i32 16, i32 %shl2, i32 0, i32 0, i32 0) | ||
| ret void | ||
| } | ||
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.
Missing check lines