-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[utils][UpdateLLCTestChecks] Add MIR support to update_llc_test_checks.py. #164965
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
Show all changes
6 commits
Select commit
Hold shift + click to select a range
0efffe4
[utils][UpdateLLCTestChecks] Add MIR support to update_llc_test_check…
vpykhtin 845e65a
improved commentary
vpykhtin 20e43ca
Merge branch 'main' into gen_mir_checks_in_ll
vpykhtin 0812e9d
use opaque pointers
vpykhtin 53d0b68
Merge branch 'main' into gen_mir_checks_in_ll
vpykhtin a3440e9
Merge branch 'main' into gen_mir_checks_in_ll
vpykhtin 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
17 changes: 17 additions & 0 deletions
17
llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/x86_asm_mir_mixed.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,17 @@ | ||
| ; RUN: llc -mtriple=x86_64 < %s | FileCheck %s --check-prefix=ASM | ||
| ; RUN: llc -mtriple=x86_64 -stop-after=finalize-isel < %s | FileCheck %s --check-prefix=MIR | ||
|
|
||
| define i64 @test1(i64 %i) nounwind readnone { | ||
| %loc = alloca i64 | ||
| %j = load i64, i64 * %loc | ||
| %r = add i64 %i, %j | ||
| ret i64 %r | ||
| } | ||
|
|
||
| define i64 @test2(i32 %i) nounwind readnone { | ||
| %loc = alloca i32 | ||
| %j = load i32, i32 * %loc | ||
| %r = add i32 %i, %j | ||
| %ext = zext i32 %r to i64 | ||
| ret i64 %ext | ||
| } | ||
45 changes: 45 additions & 0 deletions
45
llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/x86_asm_mir_mixed.ll.expected
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,45 @@ | ||
| ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py | ||
| ; RUN: llc -mtriple=x86_64 < %s | FileCheck %s --check-prefix=ASM | ||
| ; RUN: llc -mtriple=x86_64 -stop-after=finalize-isel < %s | FileCheck %s --check-prefix=MIR | ||
|
|
||
| define i64 @test1(i64 %i) nounwind readnone { | ||
| ; ASM-LABEL: test1: | ||
| ; ASM: # %bb.0: | ||
| ; ASM-NEXT: movq %rdi, %rax | ||
| ; ASM-NEXT: addq -{{[0-9]+}}(%rsp), %rax | ||
| ; ASM-NEXT: retq | ||
| ; MIR-LABEL: name: test1 | ||
| ; MIR: bb.0 (%ir-block.0): | ||
| ; MIR-NEXT: liveins: $rdi | ||
| ; MIR-NEXT: {{ $}} | ||
| ; MIR-NEXT: [[COPY:%[0-9]+]]:gr64 = COPY $rdi | ||
| ; MIR-NEXT: [[ADD64rm:%[0-9]+]]:gr64 = ADD64rm [[COPY]], %stack.0.loc, 1, $noreg, 0, $noreg, implicit-def dead $eflags :: (dereferenceable load (s64) from %ir.loc) | ||
| ; MIR-NEXT: $rax = COPY [[ADD64rm]] | ||
| ; MIR-NEXT: RET 0, $rax | ||
| %loc = alloca i64 | ||
| %j = load i64, i64 * %loc | ||
vpykhtin marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| %r = add i64 %i, %j | ||
| ret i64 %r | ||
| } | ||
|
|
||
| define i64 @test2(i32 %i) nounwind readnone { | ||
| ; ASM-LABEL: test2: | ||
| ; ASM: # %bb.0: | ||
| ; ASM-NEXT: movl %edi, %eax | ||
| ; ASM-NEXT: addl -{{[0-9]+}}(%rsp), %eax | ||
| ; ASM-NEXT: retq | ||
| ; MIR-LABEL: name: test2 | ||
| ; MIR: bb.0 (%ir-block.0): | ||
| ; MIR-NEXT: liveins: $edi | ||
| ; MIR-NEXT: {{ $}} | ||
| ; MIR-NEXT: [[COPY:%[0-9]+]]:gr32 = COPY $edi | ||
| ; MIR-NEXT: [[ADD32rm:%[0-9]+]]:gr32 = ADD32rm [[COPY]], %stack.0.loc, 1, $noreg, 0, $noreg, implicit-def dead $eflags :: (dereferenceable load (s32) from %ir.loc) | ||
| ; MIR-NEXT: [[SUBREG_TO_REG:%[0-9]+]]:gr64 = SUBREG_TO_REG 0, killed [[ADD32rm]], %subreg.sub_32bit | ||
| ; MIR-NEXT: $rax = COPY [[SUBREG_TO_REG]] | ||
| ; MIR-NEXT: RET 0, $rax | ||
| %loc = alloca i32 | ||
| %j = load i32, i32 * %loc | ||
| %r = add i32 %i, %j | ||
| %ext = zext i32 %r to i64 | ||
| ret i64 %ext | ||
| } | ||
13 changes: 13 additions & 0 deletions
13
llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/x86_asm_mir_same_prefix.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,13 @@ | ||
| ; RUN: llc -mtriple=x86_64 < %s | FileCheck %s --check-prefix=CHECK | ||
| ; RUN: llc -mtriple=x86_64 -stop-after=finalize-isel < %s | FileCheck %s --check-prefix=CHECK | ||
|
|
||
| define i32 @add(i32 %a, i32 %b) { | ||
| %sum = add i32 %a, %b | ||
| ret i32 %sum | ||
| } | ||
|
|
||
| define i32 @sub(i32 %a, i32 %b) { | ||
| %diff = sub i32 %a, %b | ||
| ret i32 %diff | ||
| } | ||
|
|
16 changes: 16 additions & 0 deletions
16
.../tools/UpdateTestChecks/update_llc_test_checks/Inputs/x86_asm_mir_same_prefix.ll.expected
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,16 @@ | ||
| ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py | ||
| ; RUN: llc -mtriple=x86_64 < %s | FileCheck %s --check-prefix=CHECK | ||
| ; RUN: llc -mtriple=x86_64 -stop-after=finalize-isel < %s | FileCheck %s --check-prefix=CHECK | ||
|
|
||
| define i32 @add(i32 %a, i32 %b) { | ||
| %sum = add i32 %a, %b | ||
| ret i32 %sum | ||
| } | ||
|
|
||
| define i32 @sub(i32 %a, i32 %b) { | ||
| %diff = sub i32 %a, %b | ||
| ret i32 %diff | ||
| } | ||
|
|
||
| ;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: | ||
| ; CHECK: {{.*}} |
9 changes: 9 additions & 0 deletions
9
llvm/test/tools/UpdateTestChecks/update_llc_test_checks/x86-asm-mir-mixed.test
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,9 @@ | ||
| # REQUIRES: x86-registered-target | ||
| ## Test checking that update_llc_test_checks.py can generate both ASM and MIR checks in the same file | ||
|
|
||
| # RUN: cp -f %S/Inputs/x86_asm_mir_mixed.ll %t.ll && %update_llc_test_checks %t.ll | ||
| # RUN: diff -u %S/Inputs/x86_asm_mir_mixed.ll.expected %t.ll | ||
|
|
||
| ## Verify that running the script again on an already updated file doesn't add duplicate checks | ||
| # RUN: %update_llc_test_checks %t.ll | ||
| # RUN: diff -u %S/Inputs/x86_asm_mir_mixed.ll.expected %t.ll |
7 changes: 7 additions & 0 deletions
7
llvm/test/tools/UpdateTestChecks/update_llc_test_checks/x86-asm-mir-same-prefix.test
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,7 @@ | ||
| ## Test that using the same prefix for both ASM and MIR outputs generates a warning | ||
| ## and doesn't produce any checks. | ||
|
|
||
| # RUN: cp -f %S/Inputs/x86_asm_mir_same_prefix.ll %t.ll && %update_llc_test_checks %t.ll 2>&1 | FileCheck %s --check-prefix=WARNING | ||
| # RUN: diff -u %S/Inputs/x86_asm_mir_same_prefix.ll.expected %t.ll | ||
|
|
||
| # WARNING: WARNING: The following prefixes are used for both ASM and MIR output, which will cause FileCheck failures: CHECK |
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.