Commit 0ebe4abe authored by Khalique's avatar Khalique
Browse files

further simplifying

parent 5e60e66b
...@@ -14,18 +14,8 @@ void eliminate_identity::apply(program& p) const ...@@ -14,18 +14,8 @@ void eliminate_identity::apply(program& p) const
{ {
for(auto ins : iterator_for(p)) for(auto ins : iterator_for(p))
{ {
std::vector<instruction_ref> new_ins_inputs = ins->inputs(); if(ins->name() == "identity")
// check each input arg for identity ops, p.replace_instruction(ins, ins->inputs().front());
// replace with the input of the respective identity
for(instruction_ref& input : new_ins_inputs)
{
if(input->name() == "identity")
{
input = input->inputs().at(0);
}
}
if(new_ins_inputs != ins->inputs())
p.replace_instruction(ins, ins->get_operator(), new_ins_inputs);
} }
} }
......
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