-
Notifications
You must be signed in to change notification settings - Fork 12k
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
[CodeGen][MIR] Support parsing of scalable vectors in MIR #70893
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
f7a5dec
[CodeGen][MIR] Support parsing of scalable vectors in MIR
michaelmaitland 959c08d
Add more tests and fix craigs comments about parser
michaelmaitland 538e6a1
add test cases for failures
michaelmaitland fec6bd4
fix test
michaelmaitland 71409f7
no return after else
michaelmaitland 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 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 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
10 changes: 10 additions & 0 deletions
10
llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err0.mir
This file contains 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,10 @@ | ||
# RUN: not llc -run-pass none -o - %s 2>&1 | FileCheck %s | ||
--- | ||
name: err_after_vscale0 | ||
body: | | ||
bb.0: | ||
%0:_(<vscale) = IMPLICIT_DEF | ||
... | ||
|
||
# CHECK: expected <vscale x M x sN> or <vscale x M x pA> | ||
|
This file contains 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,9 @@ | ||
# RUN: not llc -run-pass none -o - %s 2>&1 | FileCheck %s | ||
--- | ||
name: err_after_vscale1 | ||
body: | | ||
bb.0: | ||
%0:_(<vscale notanx) = IMPLICIT_DEF | ||
... | ||
|
||
# CHECK: expected <vscale x M x sN> or <vscale x M x pA> |
10 changes: 10 additions & 0 deletions
10
llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err10.mir
This file contains 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,10 @@ | ||
# RUN: not llc -run-pass none -o - %s 2>&1 | FileCheck %s | ||
|
||
--- | ||
name: err_after_vscalexMxp | ||
body: | | ||
bb.0: | ||
%0:_(<vscale x 4 x p) = IMPLICIT_DEF | ||
... | ||
|
||
# CHECK: expected integers after 's'/'p' type character |
10 changes: 10 additions & 0 deletions
10
llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err11.mir
This file contains 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,10 @@ | ||
# RUN: not llc -run-pass none -o - %s 2>&1 | FileCheck %s | ||
|
||
--- | ||
name: err_after_vscalexMxs32 | ||
body: | | ||
bb.0: | ||
%0:_(<vscale x 4 x s32) = IMPLICIT_DEF | ||
... | ||
|
||
# CHECK: expected <vscale x M x sN> or <vscale M x pA> for vector type |
10 changes: 10 additions & 0 deletions
10
llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err12.mir
This file contains 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,10 @@ | ||
# RUN: not llc -run-pass none -o - %s 2>&1 | FileCheck %s | ||
|
||
--- | ||
name: err_after_vscalexMxp0 | ||
body: | | ||
bb.0: | ||
%0:_(<vscale x 4 x p0) = IMPLICIT_DEF | ||
... | ||
|
||
# CHECK: expected <vscale x M x sN> or <vscale M x pA> for vector type |
10 changes: 10 additions & 0 deletions
10
llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err13.mir
This file contains 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,10 @@ | ||
# RUN: not llc -run-pass none -o - %s 2>&1 | FileCheck %s | ||
|
||
--- | ||
name: err_after_vscalexMxs32X | ||
body: | | ||
bb.0: | ||
%0:_(<vscale x 4 x s32 X) = IMPLICIT_DEF | ||
... | ||
|
||
# CHECK: expected <vscale x M x sN> or <vscale M x pA> for vector type |
10 changes: 10 additions & 0 deletions
10
llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err14.mir
This file contains 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,10 @@ | ||
# RUN: not llc -run-pass none -o - %s 2>&1 | FileCheck %s | ||
|
||
--- | ||
name: err_after_vscalexMxp0 | ||
body: | | ||
bb.0: | ||
%0:_(<vscale x 4 x p0 X) = IMPLICIT_DEF | ||
... | ||
|
||
# CHECK: expected <vscale x M x sN> or <vscale M x pA> for vector type |
10 changes: 10 additions & 0 deletions
10
llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err15.mir
This file contains 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,10 @@ | ||
# RUN: not llc -run-pass none -o - %s 2>&1 | FileCheck %s | ||
|
||
--- | ||
name: err_after_vscale0 | ||
body: | | ||
bb.0: | ||
%0:_(notatype) = IMPLICIT_DEF | ||
... | ||
|
||
# CHECK: expected sN, pA, <M x sN>, <M x pA>, <vscale x M x sN>, or <vscale x M x pA> for GlobalISel type |
This file contains 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,9 @@ | ||
# RUN: not llc -run-pass none -o - %s 2>&1 | FileCheck %s | ||
--- | ||
name: err_after_vscalex0 | ||
body: | | ||
bb.0: | ||
%0:_(<vscale x) = IMPLICIT_DEF | ||
... | ||
|
||
# CHECK: expected <vscale x M x sN> or <vscale M x pA> for vector type |
This file contains 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,9 @@ | ||
# RUN: not llc -run-pass none -o - %s 2>&1 | FileCheck %s | ||
--- | ||
name: err_after_vscalex0 | ||
body: | | ||
bb.0: | ||
%0:_(<vscale x) = IMPLICIT_DEF | ||
... | ||
|
||
# CHECK: expected <vscale x M x sN> or <vscale M x pA> for vector type |
10 changes: 10 additions & 0 deletions
10
llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err4.mir
This file contains 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,10 @@ | ||
# RUN: not llc -run-pass none -o - %s 2>&1 | FileCheck %s | ||
--- | ||
name: err_after_vscalex1 | ||
body: | | ||
bb.0: | ||
%0:_(<vscale x notanint) = IMPLICIT_DEF | ||
... | ||
|
||
# CHECK: expected <vscale x M x sN> or <vscale M x pA> for vector type | ||
|
This file contains 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,9 @@ | ||
# RUN: not llc -run-pass none -o - %s 2>&1 | FileCheck %s | ||
--- | ||
name: err_after_vscalexM | ||
body: | | ||
bb.0: | ||
%0:_(<vscale x 4) = IMPLICIT_DEF | ||
... | ||
|
||
# CHECK: expected <vscale x M x sN> or <vscale M x pA> for vector type |
11 changes: 11 additions & 0 deletions
11
llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err6.mir
This file contains 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,11 @@ | ||
# RUN: not llc -run-pass none -o - %s 2>&1 | FileCheck %s | ||
|
||
--- | ||
name: err_after_vscalexMx0 | ||
body: | | ||
bb.0: | ||
%0:_(<vscale x 4 x) = IMPLICIT_DEF | ||
... | ||
|
||
# CHECK: expected <vscale x M x sN> or <vscale M x pA> for vector type | ||
|
This file contains 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,9 @@ | ||
# RUN: not llc -run-pass none -o - %s 2>&1 | FileCheck %s | ||
--- | ||
name: err_after_vscalexMx1 | ||
body: | | ||
bb.0: | ||
%0:_(<vscale x 4 x notansorp) = IMPLICIT_DEF | ||
... | ||
|
||
# CHECK: expected <vscale x M x sN> or <vscale M x pA> for vector type |
10 changes: 10 additions & 0 deletions
10
llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err8.mir
This file contains 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,10 @@ | ||
# RUN: not llc -run-pass none -o - %s 2>&1 | FileCheck %s | ||
|
||
--- | ||
name: err_after_vscalexMxs | ||
body: | | ||
bb.0: | ||
%0:_(<vscale x 4 x s) = IMPLICIT_DEF | ||
... | ||
|
||
# CHECK: expected integers after 's'/'p' type character |
11 changes: 11 additions & 0 deletions
11
llvm/test/CodeGen/MIR/Generic/scalable-vector-type-err9.mir
This file contains 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,11 @@ | ||
# RUN: not llc -run-pass none -o - %s 2>&1 | FileCheck %s | ||
--- | ||
name: err_after_vscalexMxpX | ||
body: | | ||
bb.0: | ||
%0:_(<vscale x 4 x pX) = IMPLICIT_DEF | ||
... | ||
|
||
# CHECK: expected integers after 's'/'p' type character | ||
|
||
|
This file contains 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,133 @@ | ||
# RUN: llc -run-pass=none -o - %s | FileCheck %s | ||
|
||
--- | ||
name: test_nxv1s8 | ||
body: | | ||
bb.0: | ||
; CHECK-LABEL: name: test_nxv1s8 | ||
; CHECK: [[DEF:%[0-9]+]]:_(<vscale x 1 x s8>) = IMPLICIT_DEF | ||
; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<vscale x 1 x s8>) = COPY [[DEF]](<vscale x 1 x s8>) | ||
%0:_(<vscale x 1 x s8>) = IMPLICIT_DEF | ||
%1:_(<vscale x 1 x s8>) = COPY %0 | ||
... | ||
|
||
--- | ||
name: test_nxv1s16 | ||
body: | | ||
bb.0: | ||
; CHECK-LABEL: name: test_nxv1s16 | ||
; CHECK: [[DEF:%[0-9]+]]:_(<vscale x 1 x s16>) = IMPLICIT_DEF | ||
; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<vscale x 1 x s16>) = COPY [[DEF]](<vscale x 1 x s16>) | ||
%0:_(<vscale x 1 x s16>) = IMPLICIT_DEF | ||
%1:_(<vscale x 1 x s16>) = COPY %0 | ||
... | ||
|
||
--- | ||
name: test_nxv1s32 | ||
body: | | ||
bb.0: | ||
; CHECK-LABEL: name: test_nxv1s32 | ||
; CHECK: [[DEF:%[0-9]+]]:_(<vscale x 1 x s32>) = IMPLICIT_DEF | ||
; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<vscale x 1 x s32>) = COPY [[DEF]](<vscale x 1 x s32>) | ||
%0:_(<vscale x 1 x s32>) = IMPLICIT_DEF | ||
%1:_(<vscale x 1 x s32>) = COPY %0 | ||
... | ||
|
||
--- | ||
name: test_nxv1s64 | ||
body: | | ||
bb.0: | ||
; CHECK-LABEL: name: test_nxv1s64 | ||
; CHECK: [[DEF:%[0-9]+]]:_(<vscale x 1 x s64>) = IMPLICIT_DEF | ||
; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<vscale x 1 x s64>) = COPY [[DEF]](<vscale x 1 x s64>) | ||
%0:_(<vscale x 1 x s64>) = IMPLICIT_DEF | ||
%1:_(<vscale x 1 x s64>) = COPY %0 | ||
... | ||
|
||
--- | ||
name: test_nxv4s8 | ||
body: | | ||
bb.0: | ||
; CHECK-LABEL: name: test_nxv4s8 | ||
; CHECK: [[DEF:%[0-9]+]]:_(<vscale x 4 x s8>) = IMPLICIT_DEF | ||
; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<vscale x 4 x s8>) = COPY [[DEF]](<vscale x 4 x s8>) | ||
%0:_(<vscale x 4 x s8>) = IMPLICIT_DEF | ||
%1:_(<vscale x 4 x s8>) = COPY %0 | ||
... | ||
|
||
--- | ||
name: test_nxv4s16 | ||
body: | | ||
bb.0: | ||
; CHECK-LABEL: name: test_nxv4s16 | ||
; CHECK: [[DEF:%[0-9]+]]:_(<vscale x 4 x s16>) = IMPLICIT_DEF | ||
; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<vscale x 4 x s16>) = COPY [[DEF]](<vscale x 4 x s16>) | ||
%0:_(<vscale x 4 x s16>) = IMPLICIT_DEF | ||
%1:_(<vscale x 4 x s16>) = COPY %0 | ||
... | ||
|
||
--- | ||
name: test_nxv4s32 | ||
body: | | ||
bb.0: | ||
; CHECK-LABEL: name: test_nxv4s32 | ||
; CHECK: [[DEF:%[0-9]+]]:_(<vscale x 4 x s32>) = IMPLICIT_DEF | ||
; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<vscale x 4 x s32>) = COPY [[DEF]](<vscale x 4 x s32>) | ||
%0:_(<vscale x 4 x s32>) = IMPLICIT_DEF | ||
%1:_(<vscale x 4 x s32>) = COPY %0 | ||
... | ||
|
||
--- | ||
name: test_nxv4s64 | ||
body: | | ||
bb.0: | ||
; CHECK-LABEL: name: test_nxv4s64 | ||
; CHECK: [[DEF:%[0-9]+]]:_(<vscale x 4 x s64>) = IMPLICIT_DEF | ||
; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<vscale x 4 x s64>) = COPY [[DEF]](<vscale x 4 x s64>) | ||
%0:_(<vscale x 4 x s64>) = IMPLICIT_DEF | ||
%1:_(<vscale x 4 x s64>) = COPY %0 | ||
... | ||
|
||
--- | ||
name: test_nxv1p0 | ||
body: | | ||
bb.0: | ||
; CHECK-LABEL: name: test_nxv1p0 | ||
; CHECK: [[DEF:%[0-9]+]]:_(<vscale x 1 x p0>) = IMPLICIT_DEF | ||
; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<vscale x 1 x p0>) = COPY [[DEF]](<vscale x 1 x p0>) | ||
%0:_(<vscale x 1 x p0>) = IMPLICIT_DEF | ||
%1:_(<vscale x 1 x p0>) = COPY %0 | ||
... | ||
michaelmaitland marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
--- | ||
name: test_nxv1sp1 | ||
body: | | ||
bb.0: | ||
; CHECK-LABEL: name: test_nxv1sp1 | ||
; CHECK: [[DEF:%[0-9]+]]:_(<vscale x 1 x p0>) = IMPLICIT_DEF | ||
; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<vscale x 1 x p0>) = COPY [[DEF]](<vscale x 1 x p0>) | ||
%0:_(<vscale x 1 x p0>) = IMPLICIT_DEF | ||
%1:_(<vscale x 1 x p0>) = COPY %0 | ||
... | ||
|
||
--- | ||
name: test_nxv4p0 | ||
body: | | ||
bb.0: | ||
; CHECK-LABEL: name: test_nxv4p0 | ||
; CHECK: [[DEF:%[0-9]+]]:_(<vscale x 4 x p0>) = IMPLICIT_DEF | ||
; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<vscale x 4 x p0>) = COPY [[DEF]](<vscale x 4 x p0>) | ||
%0:_(<vscale x 4 x p0>) = IMPLICIT_DEF | ||
%1:_(<vscale x 4 x p0>) = COPY %0 | ||
... | ||
|
||
--- | ||
name: test_nxv4p1 | ||
body: | | ||
bb.0: | ||
; CHECK-LABEL: name: test_nxv4p1 | ||
; CHECK: [[DEF:%[0-9]+]]:_(<vscale x 4 x p1>) = IMPLICIT_DEF | ||
; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<vscale x 4 x p1>) = COPY [[DEF]](<vscale x 4 x p1>) | ||
%0:_(<vscale x 4 x p1>) = IMPLICIT_DEF | ||
%1:_(<vscale x 4 x p1>) = COPY %0 | ||
... |
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.
If you capture
Loc
by value here, I don't think it update whenlex()
is called. So the location will be stale.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.
Oh nevermind. Loc is passed as an argument and not coming from lex().