forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Readability: Add option to emit constants values in place
* Readability: Add option to emit constants values in place, instead of producing dedicated variables.
- Loading branch information
1 parent
e25d207
commit f3f4919
Showing
4 changed files
with
71 additions
and
10 deletions.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// RUN: mlir-translate -mlir-to-cpp -constants-as-variables=false %s | FileCheck %s -check-prefix=CPP-DEFAULT | ||
|
||
func.func @test() { | ||
%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 | ||
|
||
emitc.for %iter = %start to %stop step %step { | ||
emitc.yield | ||
} | ||
|
||
return | ||
} | ||
|
||
// CPP-DEFAULT: void test() { | ||
// CPP-DEFAULT-NEXT: for (size_t v1 = ((size_t) 0); v1 < ((size_t) 10); v1 += ((size_t) 1)) { | ||
// CPP-DEFAULT-NEXT: } | ||
// CPP-DEFAULT-NEXT: return; | ||
// CPP-DEFAULT-NEXT: } |