LLVM API Documentation

LoopUnroll.cpp
Go to the documentation of this file.
00001 //===-- UnrollLoop.cpp - Loop unrolling utilities -------------------------===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file implements some loop unrolling utilities. It does not define any
00011 // actual pass or policy, but provides a single function to perform loop
00012 // unrolling.
00013 //
00014 // The process of unrolling can produce extraneous basic blocks linked with
00015 // unconditional branches.  This will be corrected in the future.
00016 //
00017 //===----------------------------------------------------------------------===//
00018 
00019 #include "llvm/Transforms/Utils/UnrollLoop.h"
00020 #include "llvm/ADT/SmallPtrSet.h"
00021 #include "llvm/ADT/Statistic.h"
00022 #include "llvm/Analysis/InstructionSimplify.h"
00023 #include "llvm/Analysis/LoopIterator.h"
00024 #include "llvm/Analysis/LoopPass.h"
00025 #include "llvm/Analysis/ScalarEvolution.h"
00026 #include "llvm/IR/BasicBlock.h"
00027 #include "llvm/IR/DataLayout.h"
00028 #include "llvm/IR/Dominators.h"
00029 #include "llvm/IR/DiagnosticInfo.h"
00030 #include "llvm/IR/LLVMContext.h"
00031 #include "llvm/Support/Debug.h"
00032 #include "llvm/Support/raw_ostream.h"
00033 #include "llvm/Transforms/Utils/BasicBlockUtils.h"
00034 #include "llvm/Transforms/Utils/Cloning.h"
00035 #include "llvm/Transforms/Utils/Local.h"
00036 #include "llvm/Transforms/Utils/LoopUtils.h"
00037 #include "llvm/Transforms/Utils/SimplifyIndVar.h"
00038 using namespace llvm;
00039 
00040 #define DEBUG_TYPE "loop-unroll"
00041 
00042 // TODO: Should these be here or in LoopUnroll?
00043 STATISTIC(NumCompletelyUnrolled, "Number of loops completely unrolled");
00044 STATISTIC(NumUnrolled, "Number of loops unrolled (completely or otherwise)");
00045 
00046 /// RemapInstruction - Convert the instruction operands from referencing the
00047 /// current values into those specified by VMap.
00048 static inline void RemapInstruction(Instruction *I,
00049                                     ValueToValueMapTy &VMap) {
00050   for (unsigned op = 0, E = I->getNumOperands(); op != E; ++op) {
00051     Value *Op = I->getOperand(op);
00052     ValueToValueMapTy::iterator It = VMap.find(Op);
00053     if (It != VMap.end())
00054       I->setOperand(op, It->second);
00055   }
00056 
00057   if (PHINode *PN = dyn_cast<PHINode>(I)) {
00058     for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) {
00059       ValueToValueMapTy::iterator It = VMap.find(PN->getIncomingBlock(i));
00060       if (It != VMap.end())
00061         PN->setIncomingBlock(i, cast<BasicBlock>(It->second));
00062     }
00063   }
00064 }
00065 
00066 /// FoldBlockIntoPredecessor - Folds a basic block into its predecessor if it
00067 /// only has one predecessor, and that predecessor only has one successor.
00068 /// The LoopInfo Analysis that is passed will be kept consistent.  If folding is
00069 /// successful references to the containing loop must be removed from
00070 /// ScalarEvolution by calling ScalarEvolution::forgetLoop because SE may have
00071 /// references to the eliminated BB.  The argument ForgottenLoops contains a set
00072 /// of loops that have already been forgotten to prevent redundant, expensive
00073 /// calls to ScalarEvolution::forgetLoop.  Returns the new combined block.
00074 static BasicBlock *
00075 FoldBlockIntoPredecessor(BasicBlock *BB, LoopInfo* LI, LPPassManager *LPM,
00076                          SmallPtrSetImpl<Loop *> &ForgottenLoops) {
00077   // Merge basic blocks into their predecessor if there is only one distinct
00078   // pred, and if there is only one distinct successor of the predecessor, and
00079   // if there are no PHI nodes.
00080   BasicBlock *OnlyPred = BB->getSinglePredecessor();
00081   if (!OnlyPred) return nullptr;
00082 
00083   if (OnlyPred->getTerminator()->getNumSuccessors() != 1)
00084     return nullptr;
00085 
00086   DEBUG(dbgs() << "Merging: " << *BB << "into: " << *OnlyPred);
00087 
00088   // Resolve any PHI nodes at the start of the block.  They are all
00089   // guaranteed to have exactly one entry if they exist, unless there are
00090   // multiple duplicate (but guaranteed to be equal) entries for the
00091   // incoming edges.  This occurs when there are multiple edges from
00092   // OnlyPred to OnlySucc.
00093   FoldSingleEntryPHINodes(BB);
00094 
00095   // Delete the unconditional branch from the predecessor...
00096   OnlyPred->getInstList().pop_back();
00097 
00098   // Make all PHI nodes that referred to BB now refer to Pred as their
00099   // source...
00100   BB->replaceAllUsesWith(OnlyPred);
00101 
00102   // Move all definitions in the successor to the predecessor...
00103   OnlyPred->getInstList().splice(OnlyPred->end(), BB->getInstList());
00104 
00105   // OldName will be valid until erased.
00106   StringRef OldName = BB->getName();
00107 
00108   // Erase basic block from the function...
00109 
00110   // ScalarEvolution holds references to loop exit blocks.
00111   if (LPM) {
00112     if (ScalarEvolution *SE = LPM->getAnalysisIfAvailable<ScalarEvolution>()) {
00113       if (Loop *L = LI->getLoopFor(BB)) {
00114         if (ForgottenLoops.insert(L))
00115           SE->forgetLoop(L);
00116       }
00117     }
00118   }
00119   LI->removeBlock(BB);
00120 
00121   // Inherit predecessor's name if it exists...
00122   if (!OldName.empty() && !OnlyPred->hasName())
00123     OnlyPred->setName(OldName);
00124 
00125   BB->eraseFromParent();
00126 
00127   return OnlyPred;
00128 }
00129 
00130 /// Unroll the given loop by Count. The loop must be in LCSSA form. Returns true
00131 /// if unrolling was successful, or false if the loop was unmodified. Unrolling
00132 /// can only fail when the loop's latch block is not terminated by a conditional
00133 /// branch instruction. However, if the trip count (and multiple) are not known,
00134 /// loop unrolling will mostly produce more code that is no faster.
00135 ///
00136 /// TripCount is generally defined as the number of times the loop header
00137 /// executes. UnrollLoop relaxes the definition to permit early exits: here
00138 /// TripCount is the iteration on which control exits LatchBlock if no early
00139 /// exits were taken. Note that UnrollLoop assumes that the loop counter test
00140 /// terminates LatchBlock in order to remove unnecesssary instances of the
00141 /// test. In other words, control may exit the loop prior to TripCount
00142 /// iterations via an early branch, but control may not exit the loop from the
00143 /// LatchBlock's terminator prior to TripCount iterations.
00144 ///
00145 /// Similarly, TripMultiple divides the number of times that the LatchBlock may
00146 /// execute without exiting the loop.
00147 ///
00148 /// The LoopInfo Analysis that is passed will be kept consistent.
00149 ///
00150 /// If a LoopPassManager is passed in, and the loop is fully removed, it will be
00151 /// removed from the LoopPassManager as well. LPM can also be NULL.
00152 ///
00153 /// This utility preserves LoopInfo. If DominatorTree or ScalarEvolution are
00154 /// available from the Pass it must also preserve those analyses.
00155 bool llvm::UnrollLoop(Loop *L, unsigned Count, unsigned TripCount,
00156                       bool AllowRuntime, unsigned TripMultiple,
00157                       LoopInfo *LI, Pass *PP, LPPassManager *LPM) {
00158   BasicBlock *Preheader = L->getLoopPreheader();
00159   if (!Preheader) {
00160     DEBUG(dbgs() << "  Can't unroll; loop preheader-insertion failed.\n");
00161     return false;
00162   }
00163 
00164   BasicBlock *LatchBlock = L->getLoopLatch();
00165   if (!LatchBlock) {
00166     DEBUG(dbgs() << "  Can't unroll; loop exit-block-insertion failed.\n");
00167     return false;
00168   }
00169 
00170   // Loops with indirectbr cannot be cloned.
00171   if (!L->isSafeToClone()) {
00172     DEBUG(dbgs() << "  Can't unroll; Loop body cannot be cloned.\n");
00173     return false;
00174   }
00175 
00176   BasicBlock *Header = L->getHeader();
00177   BranchInst *BI = dyn_cast<BranchInst>(LatchBlock->getTerminator());
00178 
00179   if (!BI || BI->isUnconditional()) {
00180     // The loop-rotate pass can be helpful to avoid this in many cases.
00181     DEBUG(dbgs() <<
00182              "  Can't unroll; loop not terminated by a conditional branch.\n");
00183     return false;
00184   }
00185 
00186   if (Header->hasAddressTaken()) {
00187     // The loop-rotate pass can be helpful to avoid this in many cases.
00188     DEBUG(dbgs() <<
00189           "  Won't unroll loop: address of header block is taken.\n");
00190     return false;
00191   }
00192 
00193   if (TripCount != 0)
00194     DEBUG(dbgs() << "  Trip Count = " << TripCount << "\n");
00195   if (TripMultiple != 1)
00196     DEBUG(dbgs() << "  Trip Multiple = " << TripMultiple << "\n");
00197 
00198   // Effectively "DCE" unrolled iterations that are beyond the tripcount
00199   // and will never be executed.
00200   if (TripCount != 0 && Count > TripCount)
00201     Count = TripCount;
00202 
00203   // Don't enter the unroll code if there is nothing to do. This way we don't
00204   // need to support "partial unrolling by 1".
00205   if (TripCount == 0 && Count < 2)
00206     return false;
00207 
00208   assert(Count > 0);
00209   assert(TripMultiple > 0);
00210   assert(TripCount == 0 || TripCount % TripMultiple == 0);
00211 
00212   // Are we eliminating the loop control altogether?
00213   bool CompletelyUnroll = Count == TripCount;
00214 
00215   // We assume a run-time trip count if the compiler cannot
00216   // figure out the loop trip count and the unroll-runtime
00217   // flag is specified.
00218   bool RuntimeTripCount = (TripCount == 0 && Count > 0 && AllowRuntime);
00219 
00220   if (RuntimeTripCount && !UnrollRuntimeLoopProlog(L, Count, LI, LPM))
00221     return false;
00222 
00223   // Notify ScalarEvolution that the loop will be substantially changed,
00224   // if not outright eliminated.
00225   if (PP) {
00226     ScalarEvolution *SE = PP->getAnalysisIfAvailable<ScalarEvolution>();
00227     if (SE)
00228       SE->forgetLoop(L);
00229   }
00230 
00231   // If we know the trip count, we know the multiple...
00232   unsigned BreakoutTrip = 0;
00233   if (TripCount != 0) {
00234     BreakoutTrip = TripCount % Count;
00235     TripMultiple = 0;
00236   } else {
00237     // Figure out what multiple to use.
00238     BreakoutTrip = TripMultiple =
00239       (unsigned)GreatestCommonDivisor64(Count, TripMultiple);
00240   }
00241 
00242   // Report the unrolling decision.
00243   DebugLoc LoopLoc = L->getStartLoc();
00244   Function *F = Header->getParent();
00245   LLVMContext &Ctx = F->getContext();
00246 
00247   if (CompletelyUnroll) {
00248     DEBUG(dbgs() << "COMPLETELY UNROLLING loop %" << Header->getName()
00249           << " with trip count " << TripCount << "!\n");
00250     emitOptimizationRemark(Ctx, DEBUG_TYPE, *F, LoopLoc,
00251                            Twine("completely unrolled loop with ") +
00252                                Twine(TripCount) + " iterations");
00253   } else {
00254     auto EmitDiag = [&](const Twine &T) {
00255       emitOptimizationRemark(Ctx, DEBUG_TYPE, *F, LoopLoc,
00256                              "unrolled loop by a factor of " + Twine(Count) +
00257                                  T);
00258     };
00259 
00260     DEBUG(dbgs() << "UNROLLING loop %" << Header->getName()
00261           << " by " << Count);
00262     if (TripMultiple == 0 || BreakoutTrip != TripMultiple) {
00263       DEBUG(dbgs() << " with a breakout at trip " << BreakoutTrip);
00264       EmitDiag(" with a breakout at trip " + Twine(BreakoutTrip));
00265     } else if (TripMultiple != 1) {
00266       DEBUG(dbgs() << " with " << TripMultiple << " trips per branch");
00267       EmitDiag(" with " + Twine(TripMultiple) + " trips per branch");
00268     } else if (RuntimeTripCount) {
00269       DEBUG(dbgs() << " with run-time trip count");
00270       EmitDiag(" with run-time trip count");
00271     }
00272     DEBUG(dbgs() << "!\n");
00273   }
00274 
00275   bool ContinueOnTrue = L->contains(BI->getSuccessor(0));
00276   BasicBlock *LoopExit = BI->getSuccessor(ContinueOnTrue);
00277 
00278   // For the first iteration of the loop, we should use the precloned values for
00279   // PHI nodes.  Insert associations now.
00280   ValueToValueMapTy LastValueMap;
00281   std::vector<PHINode*> OrigPHINode;
00282   for (BasicBlock::iterator I = Header->begin(); isa<PHINode>(I); ++I) {
00283     OrigPHINode.push_back(cast<PHINode>(I));
00284   }
00285 
00286   std::vector<BasicBlock*> Headers;
00287   std::vector<BasicBlock*> Latches;
00288   Headers.push_back(Header);
00289   Latches.push_back(LatchBlock);
00290 
00291   // The current on-the-fly SSA update requires blocks to be processed in
00292   // reverse postorder so that LastValueMap contains the correct value at each
00293   // exit.
00294   LoopBlocksDFS DFS(L);
00295   DFS.perform(LI);
00296 
00297   // Stash the DFS iterators before adding blocks to the loop.
00298   LoopBlocksDFS::RPOIterator BlockBegin = DFS.beginRPO();
00299   LoopBlocksDFS::RPOIterator BlockEnd = DFS.endRPO();
00300 
00301   for (unsigned It = 1; It != Count; ++It) {
00302     std::vector<BasicBlock*> NewBlocks;
00303 
00304     for (LoopBlocksDFS::RPOIterator BB = BlockBegin; BB != BlockEnd; ++BB) {
00305       ValueToValueMapTy VMap;
00306       BasicBlock *New = CloneBasicBlock(*BB, VMap, "." + Twine(It));
00307       Header->getParent()->getBasicBlockList().push_back(New);
00308 
00309       // Loop over all of the PHI nodes in the block, changing them to use the
00310       // incoming values from the previous block.
00311       if (*BB == Header)
00312         for (unsigned i = 0, e = OrigPHINode.size(); i != e; ++i) {
00313           PHINode *NewPHI = cast<PHINode>(VMap[OrigPHINode[i]]);
00314           Value *InVal = NewPHI->getIncomingValueForBlock(LatchBlock);
00315           if (Instruction *InValI = dyn_cast<Instruction>(InVal))
00316             if (It > 1 && L->contains(InValI))
00317               InVal = LastValueMap[InValI];
00318           VMap[OrigPHINode[i]] = InVal;
00319           New->getInstList().erase(NewPHI);
00320         }
00321 
00322       // Update our running map of newest clones
00323       LastValueMap[*BB] = New;
00324       for (ValueToValueMapTy::iterator VI = VMap.begin(), VE = VMap.end();
00325            VI != VE; ++VI)
00326         LastValueMap[VI->first] = VI->second;
00327 
00328       L->addBasicBlockToLoop(New, LI->getBase());
00329 
00330       // Add phi entries for newly created values to all exit blocks.
00331       for (succ_iterator SI = succ_begin(*BB), SE = succ_end(*BB);
00332            SI != SE; ++SI) {
00333         if (L->contains(*SI))
00334           continue;
00335         for (BasicBlock::iterator BBI = (*SI)->begin();
00336              PHINode *phi = dyn_cast<PHINode>(BBI); ++BBI) {
00337           Value *Incoming = phi->getIncomingValueForBlock(*BB);
00338           ValueToValueMapTy::iterator It = LastValueMap.find(Incoming);
00339           if (It != LastValueMap.end())
00340             Incoming = It->second;
00341           phi->addIncoming(Incoming, New);
00342         }
00343       }
00344       // Keep track of new headers and latches as we create them, so that
00345       // we can insert the proper branches later.
00346       if (*BB == Header)
00347         Headers.push_back(New);
00348       if (*BB == LatchBlock)
00349         Latches.push_back(New);
00350 
00351       NewBlocks.push_back(New);
00352     }
00353 
00354     // Remap all instructions in the most recent iteration
00355     for (unsigned i = 0; i < NewBlocks.size(); ++i)
00356       for (BasicBlock::iterator I = NewBlocks[i]->begin(),
00357            E = NewBlocks[i]->end(); I != E; ++I)
00358         ::RemapInstruction(I, LastValueMap);
00359   }
00360 
00361   // Loop over the PHI nodes in the original block, setting incoming values.
00362   for (unsigned i = 0, e = OrigPHINode.size(); i != e; ++i) {
00363     PHINode *PN = OrigPHINode[i];
00364     if (CompletelyUnroll) {
00365       PN->replaceAllUsesWith(PN->getIncomingValueForBlock(Preheader));
00366       Header->getInstList().erase(PN);
00367     }
00368     else if (Count > 1) {
00369       Value *InVal = PN->removeIncomingValue(LatchBlock, false);
00370       // If this value was defined in the loop, take the value defined by the
00371       // last iteration of the loop.
00372       if (Instruction *InValI = dyn_cast<Instruction>(InVal)) {
00373         if (L->contains(InValI))
00374           InVal = LastValueMap[InVal];
00375       }
00376       assert(Latches.back() == LastValueMap[LatchBlock] && "bad last latch");
00377       PN->addIncoming(InVal, Latches.back());
00378     }
00379   }
00380 
00381   // Now that all the basic blocks for the unrolled iterations are in place,
00382   // set up the branches to connect them.
00383   for (unsigned i = 0, e = Latches.size(); i != e; ++i) {
00384     // The original branch was replicated in each unrolled iteration.
00385     BranchInst *Term = cast<BranchInst>(Latches[i]->getTerminator());
00386 
00387     // The branch destination.
00388     unsigned j = (i + 1) % e;
00389     BasicBlock *Dest = Headers[j];
00390     bool NeedConditional = true;
00391 
00392     if (RuntimeTripCount && j != 0) {
00393       NeedConditional = false;
00394     }
00395 
00396     // For a complete unroll, make the last iteration end with a branch
00397     // to the exit block.
00398     if (CompletelyUnroll && j == 0) {
00399       Dest = LoopExit;
00400       NeedConditional = false;
00401     }
00402 
00403     // If we know the trip count or a multiple of it, we can safely use an
00404     // unconditional branch for some iterations.
00405     if (j != BreakoutTrip && (TripMultiple == 0 || j % TripMultiple != 0)) {
00406       NeedConditional = false;
00407     }
00408 
00409     if (NeedConditional) {
00410       // Update the conditional branch's successor for the following
00411       // iteration.
00412       Term->setSuccessor(!ContinueOnTrue, Dest);
00413     } else {
00414       // Remove phi operands at this loop exit
00415       if (Dest != LoopExit) {
00416         BasicBlock *BB = Latches[i];
00417         for (succ_iterator SI = succ_begin(BB), SE = succ_end(BB);
00418              SI != SE; ++SI) {
00419           if (*SI == Headers[i])
00420             continue;
00421           for (BasicBlock::iterator BBI = (*SI)->begin();
00422                PHINode *Phi = dyn_cast<PHINode>(BBI); ++BBI) {
00423             Phi->removeIncomingValue(BB, false);
00424           }
00425         }
00426       }
00427       // Replace the conditional branch with an unconditional one.
00428       BranchInst::Create(Dest, Term);
00429       Term->eraseFromParent();
00430     }
00431   }
00432 
00433   // Merge adjacent basic blocks, if possible.
00434   SmallPtrSet<Loop *, 4> ForgottenLoops;
00435   for (unsigned i = 0, e = Latches.size(); i != e; ++i) {
00436     BranchInst *Term = cast<BranchInst>(Latches[i]->getTerminator());
00437     if (Term->isUnconditional()) {
00438       BasicBlock *Dest = Term->getSuccessor(0);
00439       if (BasicBlock *Fold = FoldBlockIntoPredecessor(Dest, LI, LPM,
00440                                                       ForgottenLoops))
00441         std::replace(Latches.begin(), Latches.end(), Dest, Fold);
00442     }
00443   }
00444 
00445   DominatorTree *DT = nullptr;
00446   if (PP) {
00447     // FIXME: Reconstruct dom info, because it is not preserved properly.
00448     // Incrementally updating domtree after loop unrolling would be easy.
00449     if (DominatorTreeWrapperPass *DTWP =
00450             PP->getAnalysisIfAvailable<DominatorTreeWrapperPass>()) {
00451       DT = &DTWP->getDomTree();
00452       DT->recalculate(*L->getHeader()->getParent());
00453     }
00454 
00455     // Simplify any new induction variables in the partially unrolled loop.
00456     ScalarEvolution *SE = PP->getAnalysisIfAvailable<ScalarEvolution>();
00457     if (SE && !CompletelyUnroll) {
00458       SmallVector<WeakVH, 16> DeadInsts;
00459       simplifyLoopIVs(L, SE, LPM, DeadInsts);
00460 
00461       // Aggressively clean up dead instructions that simplifyLoopIVs already
00462       // identified. Any remaining should be cleaned up below.
00463       while (!DeadInsts.empty())
00464         if (Instruction *Inst =
00465             dyn_cast_or_null<Instruction>(&*DeadInsts.pop_back_val()))
00466           RecursivelyDeleteTriviallyDeadInstructions(Inst);
00467     }
00468   }
00469   // At this point, the code is well formed.  We now do a quick sweep over the
00470   // inserted code, doing constant propagation and dead code elimination as we
00471   // go.
00472   const std::vector<BasicBlock*> &NewLoopBlocks = L->getBlocks();
00473   for (std::vector<BasicBlock*>::const_iterator BB = NewLoopBlocks.begin(),
00474        BBE = NewLoopBlocks.end(); BB != BBE; ++BB)
00475     for (BasicBlock::iterator I = (*BB)->begin(), E = (*BB)->end(); I != E; ) {
00476       Instruction *Inst = I++;
00477 
00478       if (isInstructionTriviallyDead(Inst))
00479         (*BB)->getInstList().erase(Inst);
00480       else if (Value *V = SimplifyInstruction(Inst))
00481         if (LI->replacementPreservesLCSSAForm(Inst, V)) {
00482           Inst->replaceAllUsesWith(V);
00483           (*BB)->getInstList().erase(Inst);
00484         }
00485     }
00486 
00487   NumCompletelyUnrolled += CompletelyUnroll;
00488   ++NumUnrolled;
00489 
00490   Loop *OuterL = L->getParentLoop();
00491   // Remove the loop from the LoopPassManager if it's completely removed.
00492   if (CompletelyUnroll && LPM != nullptr)
00493     LPM->deleteLoopFromQueue(L);
00494 
00495   // If we have a pass and a DominatorTree we should re-simplify impacted loops
00496   // to ensure subsequent analyses can rely on this form. We want to simplify
00497   // at least one layer outside of the loop that was unrolled so that any
00498   // changes to the parent loop exposed by the unrolling are considered.
00499   if (PP && DT) {
00500     if (!OuterL && !CompletelyUnroll)
00501       OuterL = L;
00502     if (OuterL) {
00503       DataLayoutPass *DLP = PP->getAnalysisIfAvailable<DataLayoutPass>();
00504       const DataLayout *DL = DLP ? &DLP->getDataLayout() : nullptr;
00505       ScalarEvolution *SE = PP->getAnalysisIfAvailable<ScalarEvolution>();
00506       simplifyLoop(OuterL, DT, LI, PP, /*AliasAnalysis*/ nullptr, SE, DL);
00507 
00508       // LCSSA must be performed on the outermost affected loop. The unrolled
00509       // loop's last loop latch is guaranteed to be in the outermost loop after
00510       // deleteLoopFromQueue updates LoopInfo.
00511       Loop *LatchLoop = LI->getLoopFor(Latches.back());
00512       if (!OuterL->contains(LatchLoop))
00513         while (OuterL->getParentLoop() != LatchLoop)
00514           OuterL = OuterL->getParentLoop();
00515 
00516       formLCSSARecursively(*OuterL, *DT, SE);
00517     }
00518   }
00519 
00520   return true;
00521 }