-
Notifications
You must be signed in to change notification settings - Fork 14.4k
[MLIR][Target/Cpp] Natural induction variable naming. #136102
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
Open
ndegener-amd
wants to merge
11
commits into
llvm:main
Choose a base branch
from
Xilinx:niklas.induction_var_naming
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+157
−27
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
c5cd08c
Natural induction variable naming.
ndegener-amd 367a8dd
Updated naming of getOrCreateName func for forOps
ndegener-amd ab73ced
Adjusted naming to change at 't' rather than 'z'
ndegener-amd 41ccc87
Change to correct getName func for induction vars
ndegener-amd 4c03abe
Dropped underscores; Same index for 'u's
ndegener-amd 4ff3a77
Merge branch 'main' into niklas.induction_var_naming
ndegener-amd a39c06e
Fixed comments
ndegener-amd 22308e1
Merge remote-tracking branch 'upstream/main' into niklas.induction_va…
ndegener-amd f267a12
Merge branch 'main' into niklas.induction_var_naming
ndegener-amd be5e25e
Remove scoping for classes
ndegener-amd 9248fb9
Merge branch 'main' into niklas.induction_var_naming
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// RUN: mlir-translate -mlir-to-cpp %s | FileCheck %s | ||
|
||
// CHECK-LABEL: test_for_siblings | ||
func.func @test_for_siblings() { | ||
%start = emitc.literal "0" : index | ||
%stop = emitc.literal "10" : index | ||
%step = emitc.literal "1" : index | ||
|
||
%var1 = "emitc.variable"() <{value = 0 : index}> : () -> !emitc.lvalue<index> | ||
%var2 = "emitc.variable"() <{value = 0 : index}> : () -> !emitc.lvalue<index> | ||
|
||
// 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) -> () | ||
emitc.assign %i0 : index to %var1 : !emitc.lvalue<index> | ||
// CHECK: {{.*}} = [[ITER1]]; | ||
//"emitc.assign"(%var2,%i1) : (!emitc.lvalue<!emitc.size_t>, !emitc.size_t) -> () | ||
emitc.assign %i1 : index to %var2 : !emitc.lvalue<index> | ||
} | ||
} | ||
// 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.literal "0" : index | ||
%stop = emitc.literal "10" : index | ||
%step = emitc.literal "1" : index | ||
|
||
// CHECK-COUNT-12: for (size_t [[ITER:[i-t][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 { | ||
// CHECK: for (size_t [[ITERu0:u13]] = {{.*}}; [[ITERu0]] < {{.*}}; [[ITERu0]] += {{.*}}) { | ||
emitc.for %i14 = %start to %stop step %step { | ||
// CHECK: for (size_t [[ITERu1:u14]] = {{.*}}; [[ITERu1]] < {{.*}}; [[ITERu1]] += {{.*}}) { | ||
emitc.for %i15 = %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.