-
Notifications
You must be signed in to change notification settings - Fork 13.4k
[SelectionDAG] Preserve volatile undef stores. #99918
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 all commits
75fcfe0
13dad1b
bbbfe89
be407ec
1372c6c
360a94c
98dad1c
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 |
---|---|---|
|
@@ -90,3 +90,61 @@ define void @test_store_def(i64 %param0, i32 %param1, ptr %out) { | |
store %struct.T %S2, ptr %out | ||
ret void | ||
} | ||
|
||
define void @test_store_volatile_undef(ptr %out, <8 x i32> %vec) { | ||
; CHECK-LABEL: test_store_volatile_undef( | ||
; CHECK: { | ||
; CHECK-NEXT: .reg .b32 %r<23>; | ||
; CHECK-NEXT: .reg .b64 %rd<5>; | ||
; CHECK-EMPTY: | ||
; CHECK-NEXT: // %bb.0: | ||
; CHECK-NEXT: ld.param.u64 %rd1, [test_store_volatile_undef_param_0]; | ||
; CHECK-NEXT: st.volatile.v4.u32 [%rd1+16], {%r1, %r2, %r3, %r4}; | ||
; CHECK-NEXT: st.volatile.v2.u32 [%rd1+8], {%r5, %r6}; | ||
; CHECK-NEXT: st.volatile.u64 [%rd1], %rd2; | ||
; CHECK-NEXT: ld.param.v4.u32 {%r7, %r8, %r9, %r10}, [test_store_volatile_undef_param_1]; | ||
; CHECK-NEXT: ld.param.v4.u32 {%r11, %r12, %r13, %r14}, [test_store_volatile_undef_param_1+16]; | ||
; CHECK-NEXT: st.volatile.v4.u32 [%rd3], {%r11, %r12, %r13, %r14}; | ||
; CHECK-NEXT: st.volatile.v4.u32 [%rd4], {%r7, %r8, %r9, %r10}; | ||
; CHECK-NEXT: st.volatile.v4.u32 [%rd1+16], {%r15, %r16, %r17, %r18}; | ||
; CHECK-NEXT: st.volatile.v4.u32 [%rd1], {%r19, %r20, %r21, %r22}; | ||
; CHECK-NEXT: ret; | ||
store volatile %struct.T undef, ptr %out | ||
store volatile <8 x i32> %vec, ptr undef | ||
store volatile <8 x i32> undef, ptr %out | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So just for my understanding, we are essentially lowering a volatile store of
to
? And similar for a volatile store of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @gonzalobg, yes. In this case both will be lowered to |
||
ret void | ||
} | ||
|
||
define void @test_store_volatile_of_poison(ptr %out) { | ||
; CHECK-LABEL: test_store_volatile_of_poison( | ||
; CHECK: { | ||
; CHECK-NEXT: .reg .b32 %r<7>; | ||
; CHECK-NEXT: .reg .b64 %rd<3>; | ||
; CHECK-EMPTY: | ||
; CHECK-NEXT: // %bb.0: | ||
; CHECK-NEXT: ld.param.u64 %rd1, [test_store_volatile_of_poison_param_0]; | ||
; CHECK-NEXT: st.volatile.v4.u32 [%rd1+16], {%r1, %r2, %r3, %r4}; | ||
; CHECK-NEXT: st.volatile.v2.u32 [%rd1+8], {%r5, %r6}; | ||
; CHECK-NEXT: st.volatile.u64 [%rd1], %rd2; | ||
; CHECK-NEXT: ret; | ||
store volatile %struct.T poison, ptr %out | ||
ret void | ||
} | ||
|
||
define void @test_store_volatile_to_poison(%struct.T %param) { | ||
; CHECK-LABEL: test_store_volatile_to_poison( | ||
; CHECK: { | ||
; CHECK-NEXT: .reg .b32 %r<7>; | ||
; CHECK-NEXT: .reg .b64 %rd<5>; | ||
; CHECK-EMPTY: | ||
; CHECK-NEXT: // %bb.0: | ||
; CHECK-NEXT: ld.param.u64 %rd1, [test_store_volatile_to_poison_param_0]; | ||
; CHECK-NEXT: ld.param.v2.u32 {%r1, %r2}, [test_store_volatile_to_poison_param_0+8]; | ||
; CHECK-NEXT: ld.param.v4.u32 {%r3, %r4, %r5, %r6}, [test_store_volatile_to_poison_param_0+16]; | ||
; CHECK-NEXT: st.volatile.v4.u32 [%rd2], {%r3, %r4, %r5, %r6}; | ||
; CHECK-NEXT: st.volatile.v2.u32 [%rd3], {%r1, %r2}; | ||
; CHECK-NEXT: st.volatile.u64 [%rd4], %rd1; | ||
; CHECK-NEXT: ret; | ||
store volatile %struct.T %param, ptr poison | ||
ret void | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also test a vector, and store to poison There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Specifically a vector that requires legalization splitting There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (curious only): Are atomic undef stores preserved as well? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, I see those get turned into unreachable in opt -O3 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And |
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.
Don't know why these tests are losing volatile
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.
In this case, the removal of the volatile preserves the original intent of the test, that there is no
store_dword
. I'm not really sure what we should here since this test is explicitly checking for the absence of a store.