forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 4
Niklas.variable naming #529
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 all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
05a9c3b
Working implementation
ndegener-amd 4ba9478
Added test cases
ndegener-amd 2118dfb
Test relied on old variable naming
ndegener-amd 634e371
Removed unnecessary vars and checks, added indents, reduced nesting c…
ndegener-amd 5dc64f2
Updated name, added separate emitc::forOp scoping, reduced constants
ndegener-amd ae1ed6e
Renamed test, removed additional unnecessary checks
ndegener-amd fdc39d1
Auto updated formatting
ndegener-amd 350a0f4
Removed unused var
ndegener-amd 7a24817
Removed additional scoping, updated naming system
ndegener-amd 12199bc
Fixed issues that resulted in test failure
ndegener-amd ac72032
Updated naming test
ndegener-amd 3606ec3
Reverted changes to Scope, removed unnecessary struct
ndegener-amd 8750f4b
Adjusted test case, removed redundant checks
ndegener-amd f627d3e
Minor clean-up
ndegener-amd 8b588c0
Removed auto-added include
ndegener-amd b139e8d
Replaced value stack by counter
ndegener-amd 59a3b4c
Recombined scoped hashtables
ndegener-amd c0240fa
Added polymorphic scope, removed unnecessary scopes, refactored code
ndegener-amd 0635689
Interleaved check statements in test
ndegener-amd 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 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| // RUN: mlir-translate -mlir-to-cpp %s | FileCheck %s | ||
|
|
||
| // CHECK-LABEL: test_for_siblings | ||
| func.func @test_for_siblings() { | ||
| %start = "emitc.constant"() <{value = 0 : index}> : () -> !emitc.size_t | ||
| %stop = "emitc.constant"() <{value = 10 : index}> : () -> !emitc.size_t | ||
| %step = "emitc.constant"() <{value = 1 : index}> : () -> !emitc.size_t | ||
|
|
||
| %var1 = "emitc.variable"() <{value = 0 : index}> : () -> !emitc.lvalue<!emitc.size_t> | ||
| %var2 = "emitc.variable"() <{value = 0 : index}> : () -> !emitc.lvalue<!emitc.size_t> | ||
|
|
||
| // CHECK: for (size_t [[ITER0:i_[0-9]*]] = {{.*}}; [[ITER0]] < {{.*}}; [[ITER0]] += {{.*}}) { | ||
| emitc.for %i0 = %start to %stop step %step { | ||
| // CHECK: for (size_t [[ITER1:j_[0-9]*]] = {{.*}}; [[ITER1]] < {{.*}}; [[ITER1]] += {{.*}}) { | ||
| emitc.for %i1 = %start to %stop step %step { | ||
| // CHECK: {{.*}} = [[ITER0]]; | ||
| "emitc.assign"(%var1,%i0) : (!emitc.lvalue<!emitc.size_t>, !emitc.size_t) -> () | ||
| // CHECK: {{.*}} = [[ITER1]]; | ||
| "emitc.assign"(%var2,%i1) : (!emitc.lvalue<!emitc.size_t>, !emitc.size_t) -> () | ||
| } | ||
| } | ||
| // CHECK: for (size_t [[ITER2:i_[0-9]*]] = {{.*}}; [[ITER2]] < {{.*}}; [[ITER2]] += {{.*}}) | ||
| emitc.for %ki2 = %start to %stop step %step { | ||
| // CHECK: for (size_t [[ITER3:j_[0-9]*]] = {{.*}}; [[ITER3]] < {{.*}}; [[ITER3]] += {{.*}}) | ||
| emitc.for %i3 = %start to %stop step %step { | ||
| %1 = emitc.call_opaque "f"() : () -> i32 | ||
| } | ||
| } | ||
| return | ||
| } | ||
|
|
||
| // CHECK-LABEL: test_for_nesting | ||
| func.func @test_for_nesting() { | ||
| %start = "emitc.constant"() <{value = 0 : index}> : () -> !emitc.size_t | ||
| %stop = "emitc.constant"() <{value = 10 : index}> : () -> !emitc.size_t | ||
| %step = "emitc.constant"() <{value = 1 : index}> : () -> !emitc.size_t | ||
|
|
||
| // CHECK-COUNT-18: for (size_t [[ITER:[i-z]_[0-9]*]] = {{.*}}; [[ITER]] < {{.*}}; [[ITER]] += {{.*}}) { | ||
| emitc.for %i0 = %start to %stop step %step { | ||
| emitc.for %i1 = %start to %stop step %step { | ||
| emitc.for %i2 = %start to %stop step %step { | ||
| emitc.for %i3 = %start to %stop step %step { | ||
| emitc.for %i4 = %start to %stop step %step { | ||
| emitc.for %i5 = %start to %stop step %step { | ||
| emitc.for %i6 = %start to %stop step %step { | ||
| emitc.for %i7 = %start to %stop step %step { | ||
| emitc.for %i8 = %start to %stop step %step { | ||
| emitc.for %i9 = %start to %stop step %step { | ||
| emitc.for %i10 = %start to %stop step %step { | ||
| emitc.for %i11 = %start to %stop step %step { | ||
| emitc.for %i12 = %start to %stop step %step { | ||
| emitc.for %i13 = %start to %stop step %step { | ||
| emitc.for %i14 = %start to %stop step %step { | ||
| emitc.for %i15 = %start to %stop step %step { | ||
| emitc.for %i16 = %start to %stop step %step { | ||
| emitc.for %i17 = %start to %stop step %step { | ||
| // CHECK: for (size_t [[ITERz0:z0_[0-9]*]] = {{.*}}; [[ITERz0]] < {{.*}}; [[ITERz0]] += {{.*}}) { | ||
| emitc.for %i18 = %start to %stop step %step { | ||
| // CHECK: for (size_t [[ITERz1:z1_[0-9]*]] = {{.*}}; [[ITERz1]] < {{.*}}; [[ITERz1]] += {{.*}}) { | ||
| emitc.for %i19 = %start to %stop step %step { | ||
| %0 = emitc.call_opaque "f"() : () -> i32 | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| return | ||
| } |
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.