Open vext01 opened 2 years ago
This will be needed for #414.
It will be something like:
diff --git a/llvm/lib/Transforms/Yk/BlockDisambiguate.cpp b/llvm/lib/Transforms/Yk/BlockDisambiguate.cpp index 270b37f70264..55b6493d9651 100644 --- a/llvm/lib/Transforms/Yk/BlockDisambiguate.cpp +++ b/llvm/lib/Transforms/Yk/BlockDisambiguate.cpp @@ -191,7 +191,6 @@ private: std::vector<BasicBlock *> NewBBs; for (BasicBlock &BB : F) { Instruction *TI = BB.getTerminator(); - assert(!isa<IndirectBrInst>(TI)); // YKFIXME: not implemented. if (isa<BranchInst>(TI)) { BranchInst *BI = cast<BranchInst>(TI); for (unsigned SuccIdx = 0; SuccIdx < BI->getNumSuccessors(); @@ -212,6 +211,16 @@ private: SI->setSuccessor(SuccIdx, DBB); } } + } else if (isa<IndirectBrInst>(TI)) { + IndirectBrInst *IBI = cast<IndirectBrInst>(TI); + for (unsigned SuccIdx = 0; SuccIdx < IBI->getNumSuccessors(); + SuccIdx++) { + BasicBlock *SuccBB = IBI->getSuccessor(SuccIdx); + if (SuccBB == &BB) { + BasicBlock *DBB = makeDisambiguationBB(Context, &BB, NewBBs); + IBI->setSuccessor(SuccIdx, DBB); + } + } } }
@vext01 I doubt this one is still relevant?
This will be needed for #414.
It will be something like: