Skip to content

Commit

Permalink
Fix analysis of rewrites where operation is inaccesible
Browse files Browse the repository at this point in the history
  • Loading branch information
math-fehr committed Nov 28, 2023
1 parent ddad126 commit 068376a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions xdsl_pdl/analysis/pdl_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,17 +492,19 @@ def _analyze_rhs_op(self, rhs_op: Operation) -> AnalyzedPDLOperation | None:
# Get the operation that is going to be replaced
assert isinstance(rhs_op.op_value.owner, pdl.OperationOp)
if (analyzed_op := self.get_analysis(rhs_op.op_value.owner)) is None:
raise PDLAnalysisException(
rhs_op, "Unknown pdl.Operation to be replaced!"
raise PDLAnalysisAborted(
rhs_op,
"pdl.Operation to be replaced is not part of the matched DAG!",
)
# Replacing with an operation
if rhs_op.repl_operation:
assert isinstance(rhs_op.repl_operation.owner, pdl.OperationOp)
if (
analyzed_repl_op := self.get_analysis(rhs_op.repl_operation.owner)
) is None:
raise PDLAnalysisException(
rhs_op, "Unknown pdl.Operation to be replaced!"
raise PDLAnalysisAborted(
rhs_op,
"pdl.Operation used for replacement is not part of the matched DAG!",
)
analyzed_op.replaced_by = analyzed_repl_op

Expand Down

0 comments on commit 068376a

Please sign in to comment.