-
Notifications
You must be signed in to change notification settings - Fork 612
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Legalize newly added compiler hints ops. (#18689)
This was missed in the prior patch adding the util.assume.* ops. Adds tests, including for the untested util.optimization_barrier op. Signed-off-by: Stella Laurenzo <[email protected]>
- Loading branch information
1 parent
a9f5628
commit 79e979f
Showing
4 changed files
with
66 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ iree_lit_test_suite( | |
NAME | ||
lit | ||
SRCS | ||
"compiler_hints.mlir" | ||
"structural_ops.mlir" | ||
TOOLS | ||
FileCheck | ||
|
32 changes: 32 additions & 0 deletions
32
compiler/src/iree/compiler/Dialect/Util/Conversion/test/compiler_hints.mlir
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,32 @@ | ||
// RUN: iree-opt --split-input-file --pass-pipeline='builtin.module(iree-util-test-conversion{widen-integers})' %s | FileCheck %s | ||
|
||
// CHECK-LABEL: @assumeDivisibleOp | ||
util.func public @assumeDivisibleOp(%arg0 : i16) -> i16 { | ||
// CHECK: util.assume.divisible {{.*}} by 4 : i32 | ||
%0 = util.assume.divisible %arg0 by 4 : i16 | ||
util.return %0 : i16 | ||
} | ||
|
||
// ----- | ||
// CHECK-LABEL: @assumeNarrowOp | ||
util.func public @assumeNarrowOp(%arg0 : i16) -> i16 { | ||
// CHECK: util.assume.narrow %arg0 : i32 to i8 | ||
%0 = util.assume.narrow %arg0 : i16 to i8 | ||
util.return %0 : i16 | ||
} | ||
|
||
// ----- | ||
// CHECK-LABEL: @assumeRangeOp | ||
util.func public @assumeRangeOp(%arg0 : i16) -> i16 { | ||
// CHECK: util.assume.range %arg0 in [4, 12] : i32 | ||
%0 = util.assume.range %arg0 in [4, 12] : i16 | ||
util.return %0 : i16 | ||
} | ||
|
||
// ----- | ||
// CHECK-LABEL: @optimizationBarrier | ||
util.func public @optimizationBarrier(%arg0 : i16) -> i16 { | ||
// CHECK: util.optimization_barrier %arg0 : i32 | ||
%0 = util.optimization_barrier %arg0 : i16 | ||
util.return %0 : i16 | ||
} |