From c73dee080cc6408aefb66fd324b09c3aed9b647b Mon Sep 17 00:00:00 2001 From: Philippe Tillet Date: Sat, 2 May 2020 17:30:15 -0400 Subject: [PATCH] [CODEGEN] Fixed bug for phi nodes with constant incoming value --- lib/codegen/selection/generator.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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);