-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[SDAG] Fix CSE for ADDRSPACECAST nodes #122912
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| ; RUN: llc < %s -mcpu=sm_80 -mattr=+ptx73 -debug-only=isel -o /dev/null 2>&1 | FileCheck %s | ||
|
|
||
| ; REQUIRES: asserts | ||
|
|
||
| target triple = "nvptx64-nvidia-cuda" | ||
|
|
||
| ;; Selection DAG CSE is hard to test since we run CSE/GVN on the IR before and | ||
| ;; after selection DAG ISel so most cases will be handled by one of these. | ||
| define void @foo(ptr %p) { | ||
| ; CHECK-LABEL: Optimized legalized selection DAG: %bb.0 'foo:' | ||
| ; CHECK: addrspacecast[0 -> 5] | ||
| ; CHECK-NOT: addrspacecast[0 -> 5] | ||
|
||
| ; CHECK-LABEL: ===== Instruction selection begins | ||
| ; | ||
| %a1 = addrspacecast ptr %p to ptr addrspace(5) | ||
| call void @llvm.stackrestore(ptr %p) | ||
AlexMaclean marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| store ptr %p, ptr addrspace(5) %a1 | ||
| ret void | ||
| } | ||
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.
You could also hack around this with -O0, the CSE always happens at any opt level (a dirtier hack would be use -start-before/after). I'm not sure I understand how stackrestore helps here.
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 was able to get around the pre-SelectionDAG CSE by using the stackrestore which causes a addrspacecast to be added during DAG legalization, so that isn't a problem. However it seems like there is some post-ISel (perhaps DAG-CSE on the machine nodes?) which is preventing the impact of this change from being easily observed in the final output. That's why I'm using the debug output.
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.
-stop-after=finalize-isel might work for avoiding machine cse