Skip to content

Commit 0ddd549

Browse files
WIP
1 parent c4a97ca commit 0ddd549

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/blocks/loops.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,9 @@ stmt::Ptr loop::convert_to_ast_impl(dominator_analysis &dta_, std::vector<std::p
380380
int next_preorder = dta_.get_preorder_bb_map()[bb->id] + 1 < (int)dta_.get_preorder().size() ? dta_.get_preorder()[dta_.get_preorder_bb_map()[bb->id] + 1] : -1;
381381
int next_next_preorder = dta_.get_preorder_bb_map()[next_preorder] + 1 < (int)dta_.get_preorder().size() ? dta_.get_preorder()[dta_.get_preorder_bb_map()[next_preorder] + 1] : -1;
382382

383-
if (blocks_id_map.count(next_preorder))
383+
if (loop_latch_blocks.size() == 1)
384+
is_last_block = true;
385+
else if (blocks_id_map.count(next_preorder))
384386
is_last_block = false;
385387
else {
386388
if (!blocks_id_map.count(next_preorder) || !blocks_id_map.count(next_next_preorder))

src/builder/builder_context.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -494,13 +494,13 @@ block::stmt::Ptr builder_context::extract_ast_from_function_impl(void) {
494494
std::cerr << "++++++ loop info ++++++ \n";
495495

496496
std::cerr << "++++++ convert to ast ++++++ \n";
497-
ast = LI.convert_to_ast(block::to<block::stmt_block>(ast));
497+
// ast = LI.convert_to_ast(block::to<block::stmt_block>(ast));
498498
std::cerr << "++++++ convert to ast ++++++ \n";
499499

500-
// block::loop_finder finder;
501-
// finder.ast = ast;
502-
// ast->accept(&finder);
503-
// return ast;
500+
block::loop_finder finder;
501+
finder.ast = ast;
502+
ast->accept(&finder);
503+
return ast;
504504

505505
block::for_loop_finder for_finder;
506506
for_finder.ast = ast;

0 commit comments

Comments
 (0)