Skip to content

Commit

Permalink
Remove unary operator inverses
Browse files Browse the repository at this point in the history
  • Loading branch information
frankmcsherry committed May 15, 2024
1 parent 4d9c287 commit 1b84be8
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/expr/src/scalar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,20 @@ impl MirScalarExpr {
}
_ => {}
}
} else if let Some(inverse_func) = func.inverse() {
if func.preserves_uniqueness()
&& inverse_func.preserves_uniqueness()
{
if let MirScalarExpr::CallUnary {
func: inner_func,
expr,
} = &mut **expr
{
if inner_func == &inverse_func {
*e = expr.take();
}
}
}
}
}
_ => {}
Expand Down

0 comments on commit 1b84be8

Please sign in to comment.