diff --git a/lib/codegen/selection/generator.cc b/lib/codegen/selection/generator.cc index e60e2567e..0a79481cb 100644 --- a/lib/codegen/selection/generator.cc +++ b/lib/codegen/selection/generator.cc @@ -195,9 +195,10 @@ void generator::visit_value(ir::value* v) { // visit operands BasicBlock *current = builder_->GetInsertBlock(); auto *inst = dynamic_cast(v); - if(inst && !dynamic_cast(v)) + if(inst) for(ir::value *op: inst->ops()){ - visit_value(op); + if(dynamic_cast(op) || !dynamic_cast(v)) + visit_value(op); } // change insert point for phi node builder_->SetInsertPoint(current);