mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-21 08:17:40 +00:00
Instead, teach SimplifyCFG to trim non-address-taken blocks from
indirectbr destination lists. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111122 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -2057,12 +2057,13 @@ bool SimplifyCFGOpt::run(BasicBlock *BB) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else if (IndirectBrInst *IBI = dyn_cast<IndirectBrInst>(BB->getTerminator())) {
|
||||
} else if (IndirectBrInst *IBI =
|
||||
dyn_cast<IndirectBrInst>(BB->getTerminator())) {
|
||||
// Eliminate redundant destinations.
|
||||
SmallPtrSet<Value *, 8> Succs;
|
||||
for (unsigned i = 0, e = IBI->getNumDestinations(); i != e; ++i) {
|
||||
BasicBlock *Dest = IBI->getDestination(i);
|
||||
if (!Succs.insert(Dest)) {
|
||||
if (!Dest->hasAddressTaken() || !Succs.insert(Dest)) {
|
||||
Dest->removePredecessor(BB);
|
||||
IBI->removeDestination(i);
|
||||
--i; --e;
|
||||
|
||||
Reference in New Issue
Block a user