Skip to content

Commit

Permalink
Mark unsafe erasures as fail
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-luecke committed Jan 16, 2024
1 parent 2ff4332 commit 96a0b76
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions xdsl_pdl/analysis/pdl_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class PDLAnalysisException(Exception):

enable_prints = True
allow_self_replacements = False
allow_unsafe_erasures = False
warnings.simplefilter("ignore", category=PDLDebugWarning)


Expand Down Expand Up @@ -571,6 +572,9 @@ def _analyze_rhs_op(self, rhs_op: Operation) -> AnalyzedPDLOperation | None:
rhs_op,
"pdl.Operation to be erased is not part of the matching DAG!",
)
if not allow_unsafe_erasures and analyzed_op not in self.generated_ops:
self._add_analysis_result_to_op(rhs_op, "unsafe erasure")
debug(f"unsafe erasure: {rhs_op}!")
analyzed_op.erased_by = rhs_op
else:
raise PDLAnalysisException(rhs_op, f"Unsupported PDL op: {rhs_op.name}")
Expand Down

0 comments on commit 96a0b76

Please sign in to comment.