@@ -412,6 +412,12 @@ namespace MxIR
412
412
if (pred->brFalse .get () == inBlock.get ())
413
413
pred->brFalse = tmpBlock;
414
414
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
+
415
421
for (auto &kv : next->phi )
416
422
for (auto &src : kv.second .srcs )
417
423
if (src.second .lock ().get () == node->outBlock )
@@ -420,16 +426,19 @@ namespace MxIR
420
426
for (auto &kv : parent.insertPoint ->brTrue ->phi )
421
427
for (auto &src : kv.second .srcs )
422
428
if (src.second .lock ().get () == parent.insertPoint )
423
- src.second = node->outBlock ->self ;
429
+ src.second = dummyBlockAfterOut;
430
+ // src.second = node->outBlock->self;
424
431
425
432
for (auto &kv : node->inBlock ->phi )
426
433
for (auto &src : kv.second .srcs )
427
434
if (src.second .lock ().get () == pred)
428
435
src.second = parent.insertPoint ->self ;
429
436
430
- next = parent.insertPoint ->brTrue ;
437
+ // next = parent.insertPoint->brTrue;
438
+ next = dummyBlockAfterOut;
431
439
parent.insertPoint ->brTrue = inBlock;
432
440
// parent.insertPoint = node->outBlock;
441
+ parent.insertPoint = dummyBlockAfterOut.get ();
433
442
434
443
std::function<void (PSTNode *)> dfs;
435
444
dfs = [&dfs, this ](PSTNode *node)
0 commit comments