mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-03-04 05:31:51 +00:00
update the comment above llvm::SplitCriticalEdge, and make
it abort on IndirectBrInst as describe in the comment. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85688 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
bcf2f2c159
commit
1b98ff3e4f
@ -116,8 +116,8 @@ bool isCriticalEdge(const TerminatorInst *TI, unsigned SuccNum,
|
|||||||
/// SplitCriticalEdge - If this edge is a critical edge, insert a new node to
|
/// SplitCriticalEdge - If this edge is a critical edge, insert a new node to
|
||||||
/// split the critical edge. This will update DominatorTree and
|
/// split the critical edge. This will update DominatorTree and
|
||||||
/// DominatorFrontier information if it is available, thus calling this pass
|
/// DominatorFrontier information if it is available, thus calling this pass
|
||||||
/// will not invalidate either of them. This returns true if the edge was split,
|
/// will not invalidate either of them. This returns the new block if the edge
|
||||||
/// false otherwise.
|
/// was split, null otherwise.
|
||||||
///
|
///
|
||||||
/// If MergeIdenticalEdges is true (not the default), *all* edges from TI to the
|
/// If MergeIdenticalEdges is true (not the default), *all* edges from TI to the
|
||||||
/// specified successor will be merged into the same critical edge block.
|
/// specified successor will be merged into the same critical edge block.
|
||||||
@ -126,10 +126,16 @@ bool isCriticalEdge(const TerminatorInst *TI, unsigned SuccNum,
|
|||||||
/// dest go to one block instead of each going to a different block, but isn't
|
/// dest go to one block instead of each going to a different block, but isn't
|
||||||
/// the standard definition of a "critical edge".
|
/// the standard definition of a "critical edge".
|
||||||
///
|
///
|
||||||
|
/// It is invalid to call this function on a critical edge that starts at an
|
||||||
|
/// IndirectBrInst. Splitting these edges will almost always create an invalid
|
||||||
|
/// program because the addr of the new block won't be the one that is jumped
|
||||||
|
/// to.
|
||||||
|
///
|
||||||
BasicBlock *SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum,
|
BasicBlock *SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum,
|
||||||
Pass *P = 0, bool MergeIdenticalEdges = false);
|
Pass *P = 0, bool MergeIdenticalEdges = false);
|
||||||
|
|
||||||
inline BasicBlock *SplitCriticalEdge(BasicBlock *BB, succ_iterator SI, Pass *P = 0) {
|
inline BasicBlock *SplitCriticalEdge(BasicBlock *BB, succ_iterator SI,
|
||||||
|
Pass *P = 0) {
|
||||||
return SplitCriticalEdge(BB->getTerminator(), SI.getSuccessorIndex(), P);
|
return SplitCriticalEdge(BB->getTerminator(), SI.getSuccessorIndex(), P);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ bool BreakCriticalEdges::runOnFunction(Function &F) {
|
|||||||
bool Changed = false;
|
bool Changed = false;
|
||||||
for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) {
|
for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) {
|
||||||
TerminatorInst *TI = I->getTerminator();
|
TerminatorInst *TI = I->getTerminator();
|
||||||
if (TI->getNumSuccessors() > 1)
|
if (TI->getNumSuccessors() > 1 && !isa<IndirectBrInst>(TI))
|
||||||
for (unsigned i = 0, e = TI->getNumSuccessors(); i != e; ++i)
|
for (unsigned i = 0, e = TI->getNumSuccessors(); i != e; ++i)
|
||||||
if (SplitCriticalEdge(TI, i, this)) {
|
if (SplitCriticalEdge(TI, i, this)) {
|
||||||
++NumBroken;
|
++NumBroken;
|
||||||
@ -150,14 +150,29 @@ static void CreatePHIsForSplitLoopExit(SmallVectorImpl<BasicBlock *> &Preds,
|
|||||||
|
|
||||||
/// SplitCriticalEdge - If this edge is a critical edge, insert a new node to
|
/// SplitCriticalEdge - If this edge is a critical edge, insert a new node to
|
||||||
/// split the critical edge. This will update DominatorTree and
|
/// split the critical edge. This will update DominatorTree and
|
||||||
/// DominatorFrontier information if it is available, thus calling this pass
|
/// DominatorFrontier information if it is available, thus calling this pass
|
||||||
/// will not invalidate any of them. This returns true if the edge was split,
|
/// will not invalidate either of them. This returns the new block if the edge
|
||||||
/// false otherwise. This ensures that all edges to that dest go to one block
|
/// was split, null otherwise.
|
||||||
/// instead of each going to a different block.
|
///
|
||||||
//
|
/// If MergeIdenticalEdges is true (not the default), *all* edges from TI to the
|
||||||
|
/// specified successor will be merged into the same critical edge block.
|
||||||
|
/// This is most commonly interesting with switch instructions, which may
|
||||||
|
/// have many edges to any one destination. This ensures that all edges to that
|
||||||
|
/// dest go to one block instead of each going to a different block, but isn't
|
||||||
|
/// the standard definition of a "critical edge".
|
||||||
|
///
|
||||||
|
/// It is invalid to call this function on a critical edge that starts at an
|
||||||
|
/// IndirectBrInst. Splitting these edges will almost always create an invalid
|
||||||
|
/// program because the addr of the new block won't be the one that is jumped
|
||||||
|
/// to.
|
||||||
|
///
|
||||||
BasicBlock *llvm::SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum,
|
BasicBlock *llvm::SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum,
|
||||||
Pass *P, bool MergeIdenticalEdges) {
|
Pass *P, bool MergeIdenticalEdges) {
|
||||||
if (!isCriticalEdge(TI, SuccNum, MergeIdenticalEdges)) return 0;
|
if (!isCriticalEdge(TI, SuccNum, MergeIdenticalEdges)) return 0;
|
||||||
|
|
||||||
|
assert(!isa<IndirectBrInst>(TI) &&
|
||||||
|
"Cannot split critical edge from IndirectBrInst");
|
||||||
|
|
||||||
BasicBlock *TIBB = TI->getParent();
|
BasicBlock *TIBB = TI->getParent();
|
||||||
BasicBlock *DestBB = TI->getSuccessor(SuccNum);
|
BasicBlock *DestBB = TI->getSuccessor(SuccNum);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user