Commit ae479183 authored by Paul's avatar Paul
Browse files

Use set to avoid compute constants twice

parent 79a5ff10
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include <migraphx/matcher.hpp> #include <migraphx/matcher.hpp>
#include <migraphx/literal.hpp> #include <migraphx/literal.hpp>
#include <migraphx/functional.hpp> #include <migraphx/functional.hpp>
#include <unordered_set>
namespace migraphx { namespace migraphx {
inline namespace MIGRAPHX_INLINE_NS { inline namespace MIGRAPHX_INLINE_NS {
...@@ -32,7 +33,8 @@ void constant_propagate::apply(program& p) const ...@@ -32,7 +33,8 @@ void constant_propagate::apply(program& p) const
return; return;
} }
} }
auto children = ins->inputs(); std::unordered_set<instruction_ref> children(ins->inputs().begin(),
ins->inputs().end());
for(auto child : children) for(auto child : children)
self(child); self(child);
})(std::prev(p.end())); })(std::prev(p.end()));
......
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