diff options
author | Sidharth Baveja <Sidharth.Baveja@ibm.com> | 2020-05-28 16:12:45 +0000 |
---|---|---|
committer | Whitney Tsang <whitneyt@ca.ibm.com> | 2020-05-28 16:44:37 +0000 |
commit | 15b6730f078329b3103a7a0476bc2227df214f4a (patch) | |
tree | 4298eade86f0141961882c850c0b11497d3de8cc /llvm/lib/Bitcode/Reader/BitcodeReader.cpp | |
parent | cc8fafa2be8d5315cc55aec54b2a6d7e60f470c4 (diff) | |
download | llvm-15b6730f078329b3103a7a0476bc2227df214f4a.zip llvm-15b6730f078329b3103a7a0476bc2227df214f4a.tar.gz llvm-15b6730f078329b3103a7a0476bc2227df214f4a.tar.bz2 |
Create utility function to Merge Adjacent Basic Blocks
Summary: The following code from
/llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp can be used by other
transformations:
while (!MergeBlocks.empty()) {
BasicBlock *BB = *MergeBlocks.begin();
BranchInst *Term = dyn_cast<BranchInst>(BB->getTerminator());
if (Term && Term->isUnconditional() &&
L->contains(Term->getSuccessor(0))) {
BasicBlock *Dest = Term->getSuccessor(0);
BasicBlock *Fold = Dest->getUniquePredecessor();
if (MergeBlockIntoPredecessor(Dest, &DTU, LI)) {
// Don't remove BB and add Fold as they are the same BB
assert(Fold == BB);
(void)Fold;
MergeBlocks.erase(Dest);
} else
MergeBlocks.erase(BB);
} else
MergeBlocks.erase(BB);
}
Hence it should be separated into its own utility function.
Authored By: sidbav
Reviewer: Whitney, Meinersbur, asbirlea, dmgreen, etiotto
Reviewed By: asbirlea
Subscribers: hiraditya, zzheng, llvm-commits
Tag: LLVM
Differential Revision: https://reviews.llvm.org/D80583
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
0 files changed, 0 insertions, 0 deletions