From 2f7626eb8b4003912e5990acf774ba44997ca378 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EB=B0=95=EC=A2=85=ED=98=84/=EB=8F=99=EC=9E=91=EC=A0=9C?= =?utf8?q?=EC=96=B4Lab=28SR=29/Staff=20Engineer/=EC=82=BC=EC=84=B1?= =?utf8?q?=EC=A0=84=EC=9E=90?= Date: Wed, 5 Dec 2018 13:50:50 +0900 Subject: [PATCH] [enco] Use "destroy_all" in coco (#2501) The current implementation of Free Op Elimination pass uses its own destroy function, but OpManager now provides "destroy_all" method which has exactly same functionality. Signed-off-by: Jonghyun Park --- .../enco/core/src/Transforms/FreeOpElimination.cpp | 31 +--------------------- 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/contrib/enco/core/src/Transforms/FreeOpElimination.cpp b/contrib/enco/core/src/Transforms/FreeOpElimination.cpp index 2bdadfb..25f2f44 100644 --- a/contrib/enco/core/src/Transforms/FreeOpElimination.cpp +++ b/contrib/enco/core/src/Transforms/FreeOpElimination.cpp @@ -18,7 +18,6 @@ #include #include -#include namespace { @@ -44,34 +43,6 @@ std::set candidates(const coco::Module *m) return res; } -/** - * @brief Destroy op tree - */ -void destroy(coco::Op *op) -{ - assert(coco::root(op) == op); - auto m = op->module(); - - std::queue q; - - q.emplace(op); - - while (q.size() > 0) - { - auto cur = q.front(); - q.pop(); - - // Insert child op nodes - for (uint32_t n = 0; n < cur->arity(); ++n) - { - q.emplace(cur->arg(n)); - } - - // Destroy the current op node - m->entity()->op()->destroy(cur); - } -} - } // namespace namespace enco @@ -81,7 +52,7 @@ void eliminate_free_op(coco::Module *m) { for (auto op : candidates(m)) { - destroy(op); + m->entity()->op()->destroy_all(op); } } -- 2.7.4