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.
Merge pull request #92 from Xilinx/matthias.pdll_dep
PDLToPDLInterp: Ensure dependencies between native constraints and their arguments
- Loading branch information
Showing
2 changed files
with
52 additions
and
0 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
21 changes: 21 additions & 0 deletions
21
mlir/test/Conversion/PDLToPDLInterp/use-constraint-result.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,21 @@ | ||
// RUN: mlir-opt -split-input-file -convert-pdl-to-pdl-interp %s | FileCheck %s | ||
|
||
// Ensuse that the dependency between add & less | ||
// causes them to be in the correct order. | ||
// CHECK: apply_constraint "__builtin_add" | ||
// CHECK: apply_constraint "__builtin_less" | ||
|
||
module { | ||
pdl.pattern @test : benefit(1) { | ||
%0 = attribute | ||
%1 = types | ||
%2 = operation "tosa.mul" {"shift" = %0} -> (%1 : !pdl.range<type>) | ||
%3 = attribute = 0 : i32 | ||
%4 = attribute = 1 : i32 | ||
%5 = apply_native_constraint "__builtin_add"(%3, %4 : !pdl.attribute, !pdl.attribute) : !pdl.attribute | ||
apply_native_constraint "__builtin_less"(%0, %5 : !pdl.attribute, !pdl.attribute) | ||
rewrite %2 { | ||
replace %2 with %2 | ||
} | ||
} | ||
} |