[CODEGEN] Fixed bug for phi nodes with constant incoming value

This commit is contained in:
Philippe Tillet
2020-05-02 17:30:15 -04:00
committed by Philippe Tillet
parent 54805596f5
commit c73dee080c

View File

@@ -195,8 +195,9 @@ void generator::visit_value(ir::value* v) {
// visit operands
BasicBlock *current = builder_->GetInsertBlock();
auto *inst = dynamic_cast<ir::instruction*>(v);
if(inst && !dynamic_cast<ir::phi_node*>(v))
if(inst)
for(ir::value *op: inst->ops()){
if(dynamic_cast<ir::constant*>(op) || !dynamic_cast<ir::phi_node*>(v))
visit_value(op);
}
// change insert point for phi node