diff options
| author | Roman Divacky <rdivacky@FreeBSD.org> | 2010-01-15 15:37:28 +0000 | 
|---|---|---|
| committer | Roman Divacky <rdivacky@FreeBSD.org> | 2010-01-15 15:37:28 +0000 | 
| commit | 829000e035f46f2a227a5466e4e427a2f3cc00a9 (patch) | |
| tree | be5a687969f682edded4aa6f13594ffd9aa9030e /lib/Transforms/Utils/BasicBlockUtils.cpp | |
| parent | 1e7804dbd25b8dbf534c850355d70ad215206f4b (diff) | |
Notes
Diffstat (limited to 'lib/Transforms/Utils/BasicBlockUtils.cpp')
| -rw-r--r-- | lib/Transforms/Utils/BasicBlockUtils.cpp | 22 | 
1 files changed, 6 insertions, 16 deletions
diff --git a/lib/Transforms/Utils/BasicBlockUtils.cpp b/lib/Transforms/Utils/BasicBlockUtils.cpp index 2962e8497e8d9..e902688f20660 100644 --- a/lib/Transforms/Utils/BasicBlockUtils.cpp +++ b/lib/Transforms/Utils/BasicBlockUtils.cpp @@ -78,7 +78,7 @@ void llvm::FoldSingleEntryPHINodes(BasicBlock *BB) {  /// is dead. Also recursively delete any operands that become dead as  /// a result. This includes tracing the def-use list from the PHI to see if  /// it is ultimately unused or if it reaches an unused cycle. -void llvm::DeleteDeadPHIs(BasicBlock *BB) { +bool llvm::DeleteDeadPHIs(BasicBlock *BB) {    // Recursively deleting a PHI may cause multiple PHIs to be deleted    // or RAUW'd undef, so use an array of WeakVH for the PHIs to delete.    SmallVector<WeakVH, 8> PHIs; @@ -86,9 +86,12 @@ void llvm::DeleteDeadPHIs(BasicBlock *BB) {         PHINode *PN = dyn_cast<PHINode>(I); ++I)      PHIs.push_back(PN); +  bool Changed = false;    for (unsigned i = 0, e = PHIs.size(); i != e; ++i)      if (PHINode *PN = dyn_cast_or_null<PHINode>(PHIs[i].operator Value*())) -      RecursivelyDeleteDeadPHINode(PN); +      Changed |= RecursivelyDeleteDeadPHINode(PN); + +  return Changed;  }  /// MergeBlockIntoPredecessor - Attempts to merge a block into its predecessor, @@ -252,7 +255,7 @@ void llvm::RemoveSuccessor(TerminatorInst *TI, unsigned SuccNum) {        Value *RetVal = 0;        // Create a value to return... if the function doesn't return null... -      if (BB->getParent()->getReturnType() != Type::getVoidTy(TI->getContext())) +      if (!BB->getParent()->getReturnType()->isVoidTy())          RetVal = Constant::getNullValue(BB->getParent()->getReturnType());        // Create the return... @@ -673,16 +676,3 @@ Value *llvm::FindAvailableLoadedValue(Value *Ptr, BasicBlock *ScanBB,    return 0;  } -/// CopyPrecedingStopPoint - If I is immediately preceded by a StopPoint, -/// make a copy of the stoppoint before InsertPos (presumably before copying -/// or moving I). -void llvm::CopyPrecedingStopPoint(Instruction *I,  -                                  BasicBlock::iterator InsertPos) { -  if (I != I->getParent()->begin()) { -    BasicBlock::iterator BBI = I;  --BBI; -    if (DbgStopPointInst *DSPI = dyn_cast<DbgStopPointInst>(BBI)) { -      CallInst *newDSPI = cast<CallInst>(DSPI->clone()); -      newDSPI->insertBefore(InsertPos); -    } -  } -}  | 
