Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b211ea1

Browse files
committed
AND EVEN MORE BUGS
1 parent 9834653 commit b211ea1

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/LoopInvariantOptimizer.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,12 @@ namespace MxIR
412412
if (pred->brFalse.get() == inBlock.get())
413413
pred->brFalse = tmpBlock;
414414

415+
std::shared_ptr<Block> dummyBlockAfterOut(Block::construct());
416+
pstParent->blocks.insert(dummyBlockAfterOut.get());
417+
dummyBlockAfterOut->pstNode = pstParent;
418+
dummyBlockAfterOut->ins = { IRJump() };
419+
dummyBlockAfterOut->brTrue = parent.insertPoint->brTrue;
420+
415421
for (auto &kv : next->phi)
416422
for (auto &src : kv.second.srcs)
417423
if (src.second.lock().get() == node->outBlock)
@@ -420,16 +426,19 @@ namespace MxIR
420426
for (auto &kv : parent.insertPoint->brTrue->phi)
421427
for (auto &src : kv.second.srcs)
422428
if (src.second.lock().get() == parent.insertPoint)
423-
src.second = node->outBlock->self;
429+
src.second = dummyBlockAfterOut;
430+
//src.second = node->outBlock->self;
424431

425432
for (auto &kv : node->inBlock->phi)
426433
for (auto &src : kv.second.srcs)
427434
if (src.second.lock().get() == pred)
428435
src.second = parent.insertPoint->self;
429436

430-
next = parent.insertPoint->brTrue;
437+
// next = parent.insertPoint->brTrue;
438+
next = dummyBlockAfterOut;
431439
parent.insertPoint->brTrue = inBlock;
432440
// parent.insertPoint = node->outBlock;
441+
parent.insertPoint = dummyBlockAfterOut.get();
433442

434443
std::function<void(PSTNode *)> dfs;
435444
dfs = [&dfs, this](PSTNode *node)

0 commit comments

Comments
 (0)