[CODEGEN] Fixed bug for phi nodes with constant incoming value
This commit is contained in:
committed by
Philippe Tillet
parent
54805596f5
commit
c73dee080c
@@ -195,9 +195,10 @@ void generator::visit_value(ir::value* v) {
|
|||||||
// visit operands
|
// visit operands
|
||||||
BasicBlock *current = builder_->GetInsertBlock();
|
BasicBlock *current = builder_->GetInsertBlock();
|
||||||
auto *inst = dynamic_cast<ir::instruction*>(v);
|
auto *inst = dynamic_cast<ir::instruction*>(v);
|
||||||
if(inst && !dynamic_cast<ir::phi_node*>(v))
|
if(inst)
|
||||||
for(ir::value *op: inst->ops()){
|
for(ir::value *op: inst->ops()){
|
||||||
visit_value(op);
|
if(dynamic_cast<ir::constant*>(op) || !dynamic_cast<ir::phi_node*>(v))
|
||||||
|
visit_value(op);
|
||||||
}
|
}
|
||||||
// change insert point for phi node
|
// change insert point for phi node
|
||||||
builder_->SetInsertPoint(current);
|
builder_->SetInsertPoint(current);
|
||||||
|
Reference in New Issue
Block a user