This patch factors out code to merge a basic block with its sole
successor -- partly for readability and partly to facilitate an
upcoming patch of my own.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
Sorry, there is a little more refactoring which could be done.
llvm/lib/Transforms/Scalar/JumpThreading.cpp | ||
---|---|---|
1884–1887 | It is better to have some early return to handle the cases in which we cannot merge. BasicBlock *SinglePred = BB->getSinglePredecessor() if (!SinglePred) return false; const Instruction *TI = SinglePred->getTerminator(); if (TI->isExceptionalTerminator() || TI->getNumSuccessors() != 1 || SinglePred == BB || hasAddressTakenAndUsed(BB)) return false; ...... |
It is better to have some early return to handle the cases in which we cannot merge.