Skip to content

Commit 4bfdc9d

Browse files
WIP
1 parent 7db8483 commit 4bfdc9d

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
@@ -491,13 +491,13 @@ block::stmt::Ptr builder_context::extract_ast_from_function_impl(void) {
491491
std::cerr << "++++++ loop info ++++++ \n";
492492

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

497-
// block::loop_finder finder;
498-
// finder.ast = ast;
499-
// ast->accept(&finder);
500-
// return ast;
497+
block::loop_finder finder;
498+
finder.ast = ast;
499+
ast->accept(&finder);
500+
return ast;
501501

502502
block::for_loop_finder for_finder;
503503
for_finder.ast = ast;

0 commit comments

Comments
 (0)