Skip to content

Commit

Permalink
refactor: simplify removeconstignore verify (#768)
Browse files Browse the repository at this point in the history
leftover review comment:
#757 (comment)
  • Loading branch information
ss2165 committed Jan 3, 2024
1 parent ca7b605 commit 5d5e088
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/hugr/rewrite/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,12 @@ impl Rewrite for RemoveConstIgnore {
if (!h.contains_node(node)) || (!h.get_optype(node).is_load_constant()) {
return Err(RemoveError::InvalidNode(node));
}

if h.out_value_types(node)
.next()
.is_some_and(|(p, _)| h.linked_inputs(node, p).next().is_some())
{
let (p, _) = h
.out_value_types(node)
.exactly_one()
.ok()
.expect("LoadConstant has only one output.");
if h.linked_inputs(node, p).next().is_some() {
return Err(RemoveError::ValueUsed(node));
}

Expand Down

0 comments on commit 5d5e088

Please sign in to comment.