Scf
scf
RehoistConstInLoops
Bases: RewritePattern
Carry out const definitions from the loops. In the future this will probably be done by the pattern rewriter itself, like it's done in the MLIR's applyPatternsAndFoldGreedily.
Source code in xdsl/transforms/canonicalization_patterns/scf.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 | |
match_and_rewrite(op: scf.ForOp, rewriter: PatternRewriter) -> None
Source code in xdsl/transforms/canonicalization_patterns/scf.py
24 25 26 27 28 29 30 | |
SimplifyTrivialLoops
Bases: RewritePattern
Rewriting pattern that erases loops that are known not to iterate, replaces single-iteration loops with their bodies, and removes empty loops that iterate at least once and only return values defined outside of the loop.
Source code in xdsl/transforms/canonicalization_patterns/scf.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
match_and_rewrite(op: scf.ForOp, rewriter: PatternRewriter) -> None
Source code in xdsl/transforms/canonicalization_patterns/scf.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
IfPropagateConstantCondition
Bases: RewritePattern
Source code in xdsl/transforms/canonicalization_patterns/scf.py
82 83 84 85 86 87 88 89 90 91 92 | |
match_and_rewrite(op: scf.IfOp, rewriter: PatternRewriter) -> None
Source code in xdsl/transforms/canonicalization_patterns/scf.py
83 84 85 86 87 88 89 90 91 92 | |
SingleBlockExecuteInliner
Bases: RewritePattern
Source code in xdsl/transforms/canonicalization_patterns/scf.py
95 96 97 98 99 100 101 102 103 | |
match_and_rewrite(op: scf.ExecuteRegionOp, rewriter: PatternRewriter) -> None
Source code in xdsl/transforms/canonicalization_patterns/scf.py
96 97 98 99 100 101 102 103 | |
replace_op_with_region(rewriter: PatternRewriter, op: Operation, region: Region, args: Sequence[SSAValue] = ())
Replaces the given op with the contents of the given single-block region, using the operands of the block terminator to replace operation results.
:raises ValueError: if the region does not have a single block.
Source code in xdsl/transforms/canonicalization_patterns/scf.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | |