diff --git a/jlm/hls/backend/rvsdg2rhls/remove-redundant-buf.cpp b/jlm/hls/backend/rvsdg2rhls/remove-redundant-buf.cpp index 6291c5804..71211e64f 100644 --- a/jlm/hls/backend/rvsdg2rhls/remove-redundant-buf.cpp +++ b/jlm/hls/backend/rvsdg2rhls/remove-redundant-buf.cpp @@ -16,19 +16,33 @@ eliminate_buf(jlm::rvsdg::output * o) if (auto so = dynamic_cast(o)) { auto node = so->node(); - if (dynamic_cast(&node->GetOperation())) + if (jlm::rvsdg::is(node->GetOperation())) { return eliminate_buf(node->input(1)->origin()); } - else if (dynamic_cast(&node->GetOperation())) + else if (jlm::rvsdg::is(node->GetOperation())) + { + // part of memory disambiguation + return eliminate_buf(node->input(0)->origin()); + } + else if (jlm::rvsdg::is(node->GetOperation())) + { + return true; + } + else if (jlm::rvsdg::is(node->GetOperation())) { return true; } - else if (dynamic_cast(&node->GetOperation())) + else if (jlm::rvsdg::is(node->GetOperation())) + { + return true; + } + else if (jlm::rvsdg::is(node->GetOperation())) { return true; } } + return false; }