-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[GlobalISel] Catching inconsistencies in load memory, result, and range metadata type #121247
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 8 commits
d18e4f7
b76c3df
b740e22
f935fc6
21d6e71
ab0d2d5
21b9ca8
3a3233f
8026866
80f6486
314a0eb
da70608
4f16afa
f2ddff5
cd6958b
c4f11af
141e4b7
b7601c0
d45d85c
9094137
6e0f428
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 |
|---|---|---|
|
|
@@ -30,6 +30,7 @@ | |
| !0 = !{i24 0, i24 1048575} | ||
| !1 = !{!"omnipotent char", !2} | ||
| !2 = !{!"Simple C/C++ TBAA"} | ||
| !3 = !{i32 0, i32 1048575} | ||
|
Contributor
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. This shouldn't touch the input IR. However this makes me realize we are violating the principle that we shouldn't touch the underlying IR in codegen. I guess global metadata constants could be an exception
Contributor
Author
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. sorry, I do not understand how to resolve the comment, this test started to fail because i24 range is used on i32 value, I have forked this range with i32 to make the test pass, should I change this test or should I change the check? Thank you!
Contributor
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. I guess it depends how we want to handle extending loads. As written, I think we should leave the test for now. However that means you need to adjust from checking the result memory type, to the memory type in the MachineMemOperand
Contributor
Author
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. got it, thank you! |
||
| ... | ||
|
|
||
| # Make sure range metadata is not preserved when widening loads, but | ||
|
|
@@ -67,7 +68,7 @@ body: | | |
| ; SI-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[COPY]](p1) :: (load (s32), !tbaa !1, addrspace 1) | ||
| ; SI-NEXT: $vgpr0 = COPY [[LOAD]](s32) | ||
| %0:_(p1) = COPY $vgpr0_vgpr1 | ||
| %1:_(s32) = G_LOAD %0 :: (load (s24), align 4, addrspace 1, !range !0, !tbaa !1) | ||
| %1:_(s32) = G_LOAD %0 :: (load (s24), align 4, addrspace 1, !range !3, !tbaa !1) | ||
| $vgpr0 = COPY %1 | ||
|
|
||
| ... | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,7 @@ | |
| !0 = !{i96 0, i96 9223372036854775808} | ||
| !1 = !{!"omnipotent char", !2} | ||
| !2 = !{!"Simple C/C++ TBAA"} | ||
| !3 = !{i32 0, i32 4294967295} | ||
|
||
| ... | ||
|
|
||
| # Make sure range metadata is not preserved when widening loads, but | ||
|
|
@@ -44,10 +45,10 @@ body: | | |
| ; GFX12: liveins: $sgpr0_sgpr1 | ||
| ; GFX12-NEXT: {{ $}} | ||
| ; GFX12-NEXT: [[COPY:%[0-9]+]]:sgpr(p4) = COPY $sgpr0_sgpr1 | ||
| ; GFX12-NEXT: [[LOAD:%[0-9]+]]:sgpr(<3 x s32>) = G_LOAD [[COPY]](p4) :: (load (<3 x s32>), align 8, !range !0, addrspace 4) | ||
| ; GFX12-NEXT: [[LOAD:%[0-9]+]]:sgpr(<3 x s32>) = G_LOAD [[COPY]](p4) :: (load (<3 x s32>), align 8 | ||
| ; GFX12-NEXT: $sgpr0_sgpr1_sgpr2 = COPY [[LOAD]](<3 x s32>) | ||
| %0:_(p4) = COPY $sgpr0_sgpr1 | ||
| %1:_(<3 x s32>) = G_LOAD %0 :: (load (<3 x s32>), align 8, addrspace 4, !range !0) | ||
| %1:_(<3 x s32>) = G_LOAD %0 :: (load (<3 x s32>), align 8, addrspace 4, !range !3) | ||
| $sgpr0_sgpr1_sgpr2 = COPY %1 | ||
|
|
||
| ... | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| # RUN: not --crash llc -mtriple=amdgcn-mesa-mesa3d -mcpu=tahiti -run-pass=none %s -filetype=null 2>&1 | FileCheck %s | ||
| --- | | ||
| define void @range_metadata_sext_i33_signed_range_i64_load_as_v2i32() { | ||
parsifal-47 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ret void | ||
| } | ||
|
|
||
| !0 = !{i64 -4294967295, i64 4294967296} | ||
| !1 = !{i64 -8589934591, i64 8589934592} | ||
|
||
|
|
||
| ... | ||
| --- | ||
| name: range_metadata_sext_i33_signed_range_i64_load_as_v2i32 | ||
parsifal-47 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| tracksRegLiveness: true | ||
| body: | | ||
| bb.0: | ||
| liveins: $vgpr0, $vgpr1 | ||
| %1:_(s32) = COPY $vgpr0 | ||
| %2:_(s32) = COPY $vgpr1 | ||
| %0:_(p1) = G_MERGE_VALUES %1(s32), %2(s32) | ||
| ; CHECK: Bad machine code: range is incompatible with the value it gets assigned to | ||
| %3:_(<2 x s32>) = G_LOAD %0(p1) :: (volatile load (s64), align 4, !range !1, addrspace 1) | ||
arsenm marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ; CHECK: Bad machine code: range is incompatible with the value it gets assigned to | ||
| %4:_(<2 x s32>) = G_LOAD %0(p1) :: (volatile load (s64), align 4, !range !0, addrspace 1) | ||
parsifal-47 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ; CHECK: Bad machine code: range is incompatible with the value it gets assigned to | ||
| %5:_(<2 x s32>) = G_LOAD %0(p1) :: (volatile load (s64), align 4, !range !0, addrspace 1) | ||
parsifal-47 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| $vgpr0_vgpr1 = COPY %3 | ||
| SI_RETURN implicit $vgpr0_vgpr1 | ||
| ... | ||
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.
This should continue to permit the extending load case to use range metadata. Verifying the result type is trickier since we need to account for valid extending loads
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.
The change to use the memory type got lost