Commit fcc84214 authored by Ted Themistokleous's avatar Ted Themistokleous
Browse files

Remove check for div zero, push this to be detected in a seperate pass

parent 728fe848
...@@ -851,20 +851,6 @@ struct find_div_const ...@@ -851,20 +851,6 @@ struct find_div_const
} }
}; };
struct find_zero_div_const
{
auto matcher() const
{
return match::name("div")(
match::arg(1)(match::skip_broadcasts_converts(match::has_value(0.0f))));
}
[[noreturn]] void apply(module&, const match::matcher_result&) const
{
MIGRAPHX_THROW("ERROR: Matched division by zero in pass");
}
};
struct find_unit_ops struct find_unit_ops
{ {
auto matcher() const auto matcher() const
...@@ -1132,7 +1118,6 @@ void simplify_algebra::apply(module& m) const ...@@ -1132,7 +1118,6 @@ void simplify_algebra::apply(module& m) const
find_unit_ops{}, find_unit_ops{},
find_neg_unit_ops{}, find_neg_unit_ops{},
find_zero_ops{}, find_zero_ops{},
find_zero_div_const{},
find_div_const{}, find_div_const{},
find_sub_const{}, find_sub_const{},
find_rsqrt{}, find_rsqrt{},
......
...@@ -1096,28 +1096,6 @@ TEST_CASE(simplify_sub_neg_zero_const_vec) ...@@ -1096,28 +1096,6 @@ TEST_CASE(simplify_sub_neg_zero_const_vec)
EXPECT(m1 == m2); EXPECT(m1 == m2);
} }
TEST_CASE(simplify_div_zero_const)
{
migraphx::module m1;
{
auto x = m1.add_parameter("x", {migraphx::shape::int32_type, {1}});
auto unit = m1.add_literal(0);
m1.add_instruction(migraphx::make_op("div"), x, unit);
}
bool result = false;
try
{
run_pass(m1);
}
catch(const std::runtime_error& e)
{
(void)e;
result = true;
}
EXPECT(result);
}
TEST_CASE(simplify_sub_const) TEST_CASE(simplify_sub_const)
{ {
migraphx::module m1; migraphx::module m1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment