diff --git a/lib/codegen/tune.cpp b/lib/codegen/tune.cpp index 72267b23f..0b4367052 100644 --- a/lib/codegen/tune.cpp +++ b/lib/codegen/tune.cpp @@ -51,7 +51,6 @@ void tune::init_c_phi(ir::instruction *v) { } void tune::init_c_graph(ir::instruction *v) { - // Reference shape ir::type::tile_shapes_t::value_type one = ir::tile_type::make_one(v->get_parent()->get_context()); ir::type::tile_shapes_t shapes; @@ -59,8 +58,10 @@ void tune::init_c_graph(ir::instruction *v) { shapes = store->get_pointer_operand()->get_type()->get_tile_shapes(); else if(auto *downcast = dynamic_cast(v)) return; - else + else{ +// std::cout << v->get_name() << std::endl; shapes = v->get_type()->get_tile_shapes(); + } // Reshape if(dynamic_cast(v)){ ir::value *op = v->get_operand(0); @@ -102,13 +103,14 @@ void tune::init_c_graph(ir::instruction *v) { } // Element-wise else if(dynamic_cast(v)) { - for(unsigned k = 0; k < v->get_num_results(); k++) + for(unsigned k = 0; k < v->get_num_results(); k++){ + ir::value *result = v->get_result(k); for(unsigned i = 0; i < shapes.size(); i ++){ - ir::value *result = v->get_result(k); for(ir::value* op: v->ops()){ add_constraint({result, i}, {op, i}); } } + } } } diff --git a/lib/lang/expression.cpp b/lib/lang/expression.cpp index 87f6a8194..6054a2694 100644 --- a/lib/lang/expression.cpp +++ b/lib/lang/expression.cpp @@ -248,7 +248,8 @@ ir::value *conditional_expression::codegen(ir::module *mod) const{ ir::value *uncasted_true_value = true_value; ir::value *uncasted_false_value = false_value; implicit_cast(builder, true_value, false_value, is_float, is_ptr, is_int, is_signed); - implicit_broadcast(mod, true_value, false_value); + implicit_broadcast(mod, pred, true_value); + implicit_broadcast(mod, pred, false_value); { ir::value *current = true_value; while(current != uncasted_true_value) {