LLVM  mainline
SimplifyIndVar.cpp
Go to the documentation of this file.
00001 //===-- SimplifyIndVar.cpp - Induction variable simplification ------------===//
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 induction variable simplification. It does
00011 // not define any actual pass or policy, but provides a single function to
00012 // simplify a loop's induction variables based on ScalarEvolution.
00013 //
00014 //===----------------------------------------------------------------------===//
00015 
00016 #include "llvm/Transforms/Utils/SimplifyIndVar.h"
00017 #include "llvm/ADT/STLExtras.h"
00018 #include "llvm/ADT/SmallVector.h"
00019 #include "llvm/ADT/Statistic.h"
00020 #include "llvm/Analysis/LoopInfo.h"
00021 #include "llvm/Analysis/LoopPass.h"
00022 #include "llvm/Analysis/ScalarEvolutionExpressions.h"
00023 #include "llvm/IR/DataLayout.h"
00024 #include "llvm/IR/Dominators.h"
00025 #include "llvm/IR/IRBuilder.h"
00026 #include "llvm/IR/Instructions.h"
00027 #include "llvm/IR/IntrinsicInst.h"
00028 #include "llvm/Support/CommandLine.h"
00029 #include "llvm/Support/Debug.h"
00030 #include "llvm/Support/raw_ostream.h"
00031 
00032 using namespace llvm;
00033 
00034 #define DEBUG_TYPE "indvars"
00035 
00036 STATISTIC(NumElimIdentity, "Number of IV identities eliminated");
00037 STATISTIC(NumElimOperand,  "Number of IV operands folded into a use");
00038 STATISTIC(NumElimRem     , "Number of IV remainder operations eliminated");
00039 STATISTIC(NumElimCmp     , "Number of IV comparisons eliminated");
00040 
00041 namespace {
00042   /// This is a utility for simplifying induction variables
00043   /// based on ScalarEvolution. It is the primary instrument of the
00044   /// IndvarSimplify pass, but it may also be directly invoked to cleanup after
00045   /// other loop passes that preserve SCEV.
00046   class SimplifyIndvar {
00047     Loop             *L;
00048     LoopInfo         *LI;
00049     ScalarEvolution  *SE;
00050 
00051     SmallVectorImpl<WeakVH> &DeadInsts;
00052 
00053     bool Changed;
00054 
00055   public:
00056     SimplifyIndvar(Loop *Loop, ScalarEvolution *SE, LoopInfo *LI,
00057                    SmallVectorImpl<WeakVH> &Dead)
00058         : L(Loop), LI(LI), SE(SE), DeadInsts(Dead), Changed(false) {
00059       assert(LI && "IV simplification requires LoopInfo");
00060     }
00061 
00062     bool hasChanged() const { return Changed; }
00063 
00064     /// Iteratively perform simplification on a worklist of users of the
00065     /// specified induction variable. This is the top-level driver that applies
00066     /// all simplicitions to users of an IV.
00067     void simplifyUsers(PHINode *CurrIV, IVVisitor *V = nullptr);
00068 
00069     Value *foldIVUser(Instruction *UseInst, Instruction *IVOperand);
00070 
00071     bool eliminateIVUser(Instruction *UseInst, Instruction *IVOperand);
00072     void eliminateIVComparison(ICmpInst *ICmp, Value *IVOperand);
00073     void eliminateIVRemainder(BinaryOperator *Rem, Value *IVOperand,
00074                               bool IsSigned);
00075     bool strengthenOverflowingOperation(BinaryOperator *OBO, Value *IVOperand);
00076 
00077     Instruction *splitOverflowIntrinsic(Instruction *IVUser,
00078                                         const DominatorTree *DT);
00079   };
00080 }
00081 
00082 /// Fold an IV operand into its use.  This removes increments of an
00083 /// aligned IV when used by a instruction that ignores the low bits.
00084 ///
00085 /// IVOperand is guaranteed SCEVable, but UseInst may not be.
00086 ///
00087 /// Return the operand of IVOperand for this induction variable if IVOperand can
00088 /// be folded (in case more folding opportunities have been exposed).
00089 /// Otherwise return null.
00090 Value *SimplifyIndvar::foldIVUser(Instruction *UseInst, Instruction *IVOperand) {
00091   Value *IVSrc = nullptr;
00092   unsigned OperIdx = 0;
00093   const SCEV *FoldedExpr = nullptr;
00094   switch (UseInst->getOpcode()) {
00095   default:
00096     return nullptr;
00097   case Instruction::UDiv:
00098   case Instruction::LShr:
00099     // We're only interested in the case where we know something about
00100     // the numerator and have a constant denominator.
00101     if (IVOperand != UseInst->getOperand(OperIdx) ||
00102         !isa<ConstantInt>(UseInst->getOperand(1)))
00103       return nullptr;
00104 
00105     // Attempt to fold a binary operator with constant operand.
00106     // e.g. ((I + 1) >> 2) => I >> 2
00107     if (!isa<BinaryOperator>(IVOperand)
00108         || !isa<ConstantInt>(IVOperand->getOperand(1)))
00109       return nullptr;
00110 
00111     IVSrc = IVOperand->getOperand(0);
00112     // IVSrc must be the (SCEVable) IV, since the other operand is const.
00113     assert(SE->isSCEVable(IVSrc->getType()) && "Expect SCEVable IV operand");
00114 
00115     ConstantInt *D = cast<ConstantInt>(UseInst->getOperand(1));
00116     if (UseInst->getOpcode() == Instruction::LShr) {
00117       // Get a constant for the divisor. See createSCEV.
00118       uint32_t BitWidth = cast<IntegerType>(UseInst->getType())->getBitWidth();
00119       if (D->getValue().uge(BitWidth))
00120         return nullptr;
00121 
00122       D = ConstantInt::get(UseInst->getContext(),
00123                            APInt::getOneBitSet(BitWidth, D->getZExtValue()));
00124     }
00125     FoldedExpr = SE->getUDivExpr(SE->getSCEV(IVSrc), SE->getSCEV(D));
00126   }
00127   // We have something that might fold it's operand. Compare SCEVs.
00128   if (!SE->isSCEVable(UseInst->getType()))
00129     return nullptr;
00130 
00131   // Bypass the operand if SCEV can prove it has no effect.
00132   if (SE->getSCEV(UseInst) != FoldedExpr)
00133     return nullptr;
00134 
00135   DEBUG(dbgs() << "INDVARS: Eliminated IV operand: " << *IVOperand
00136         << " -> " << *UseInst << '\n');
00137 
00138   UseInst->setOperand(OperIdx, IVSrc);
00139   assert(SE->getSCEV(UseInst) == FoldedExpr && "bad SCEV with folded oper");
00140 
00141   ++NumElimOperand;
00142   Changed = true;
00143   if (IVOperand->use_empty())
00144     DeadInsts.emplace_back(IVOperand);
00145   return IVSrc;
00146 }
00147 
00148 /// SimplifyIVUsers helper for eliminating useless
00149 /// comparisons against an induction variable.
00150 void SimplifyIndvar::eliminateIVComparison(ICmpInst *ICmp, Value *IVOperand) {
00151   unsigned IVOperIdx = 0;
00152   ICmpInst::Predicate Pred = ICmp->getPredicate();
00153   if (IVOperand != ICmp->getOperand(0)) {
00154     // Swapped
00155     assert(IVOperand == ICmp->getOperand(1) && "Can't find IVOperand");
00156     IVOperIdx = 1;
00157     Pred = ICmpInst::getSwappedPredicate(Pred);
00158   }
00159 
00160   // Get the SCEVs for the ICmp operands.
00161   const SCEV *S = SE->getSCEV(ICmp->getOperand(IVOperIdx));
00162   const SCEV *X = SE->getSCEV(ICmp->getOperand(1 - IVOperIdx));
00163 
00164   // Simplify unnecessary loops away.
00165   const Loop *ICmpLoop = LI->getLoopFor(ICmp->getParent());
00166   S = SE->getSCEVAtScope(S, ICmpLoop);
00167   X = SE->getSCEVAtScope(X, ICmpLoop);
00168 
00169   // If the condition is always true or always false, replace it with
00170   // a constant value.
00171   if (SE->isKnownPredicate(Pred, S, X))
00172     ICmp->replaceAllUsesWith(ConstantInt::getTrue(ICmp->getContext()));
00173   else if (SE->isKnownPredicate(ICmpInst::getInversePredicate(Pred), S, X))
00174     ICmp->replaceAllUsesWith(ConstantInt::getFalse(ICmp->getContext()));
00175   else
00176     return;
00177 
00178   DEBUG(dbgs() << "INDVARS: Eliminated comparison: " << *ICmp << '\n');
00179   ++NumElimCmp;
00180   Changed = true;
00181   DeadInsts.emplace_back(ICmp);
00182 }
00183 
00184 /// SimplifyIVUsers helper for eliminating useless
00185 /// remainder operations operating on an induction variable.
00186 void SimplifyIndvar::eliminateIVRemainder(BinaryOperator *Rem,
00187                                       Value *IVOperand,
00188                                       bool IsSigned) {
00189   // We're only interested in the case where we know something about
00190   // the numerator.
00191   if (IVOperand != Rem->getOperand(0))
00192     return;
00193 
00194   // Get the SCEVs for the ICmp operands.
00195   const SCEV *S = SE->getSCEV(Rem->getOperand(0));
00196   const SCEV *X = SE->getSCEV(Rem->getOperand(1));
00197 
00198   // Simplify unnecessary loops away.
00199   const Loop *ICmpLoop = LI->getLoopFor(Rem->getParent());
00200   S = SE->getSCEVAtScope(S, ICmpLoop);
00201   X = SE->getSCEVAtScope(X, ICmpLoop);
00202 
00203   // i % n  -->  i  if i is in [0,n).
00204   if ((!IsSigned || SE->isKnownNonNegative(S)) &&
00205       SE->isKnownPredicate(IsSigned ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT,
00206                            S, X))
00207     Rem->replaceAllUsesWith(Rem->getOperand(0));
00208   else {
00209     // (i+1) % n  -->  (i+1)==n?0:(i+1)  if i is in [0,n).
00210     const SCEV *LessOne =
00211       SE->getMinusSCEV(S, SE->getConstant(S->getType(), 1));
00212     if (IsSigned && !SE->isKnownNonNegative(LessOne))
00213       return;
00214 
00215     if (!SE->isKnownPredicate(IsSigned ?
00216                               ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT,
00217                               LessOne, X))
00218       return;
00219 
00220     ICmpInst *ICmp = new ICmpInst(Rem, ICmpInst::ICMP_EQ,
00221                                   Rem->getOperand(0), Rem->getOperand(1));
00222     SelectInst *Sel =
00223       SelectInst::Create(ICmp,
00224                          ConstantInt::get(Rem->getType(), 0),
00225                          Rem->getOperand(0), "tmp", Rem);
00226     Rem->replaceAllUsesWith(Sel);
00227   }
00228 
00229   DEBUG(dbgs() << "INDVARS: Simplified rem: " << *Rem << '\n');
00230   ++NumElimRem;
00231   Changed = true;
00232   DeadInsts.emplace_back(Rem);
00233 }
00234 
00235 /// Eliminate an operation that consumes a simple IV and has
00236 /// no observable side-effect given the range of IV values.
00237 /// IVOperand is guaranteed SCEVable, but UseInst may not be.
00238 bool SimplifyIndvar::eliminateIVUser(Instruction *UseInst,
00239                                      Instruction *IVOperand) {
00240   if (ICmpInst *ICmp = dyn_cast<ICmpInst>(UseInst)) {
00241     eliminateIVComparison(ICmp, IVOperand);
00242     return true;
00243   }
00244   if (BinaryOperator *Rem = dyn_cast<BinaryOperator>(UseInst)) {
00245     bool IsSigned = Rem->getOpcode() == Instruction::SRem;
00246     if (IsSigned || Rem->getOpcode() == Instruction::URem) {
00247       eliminateIVRemainder(Rem, IVOperand, IsSigned);
00248       return true;
00249     }
00250   }
00251 
00252   // Eliminate any operation that SCEV can prove is an identity function.
00253   if (!SE->isSCEVable(UseInst->getType()) ||
00254       (UseInst->getType() != IVOperand->getType()) ||
00255       (SE->getSCEV(UseInst) != SE->getSCEV(IVOperand)))
00256     return false;
00257 
00258   DEBUG(dbgs() << "INDVARS: Eliminated identity: " << *UseInst << '\n');
00259 
00260   UseInst->replaceAllUsesWith(IVOperand);
00261   ++NumElimIdentity;
00262   Changed = true;
00263   DeadInsts.emplace_back(UseInst);
00264   return true;
00265 }
00266 
00267 /// Annotate BO with nsw / nuw if it provably does not signed-overflow /
00268 /// unsigned-overflow.  Returns true if anything changed, false otherwise.
00269 bool SimplifyIndvar::strengthenOverflowingOperation(BinaryOperator *BO,
00270                                                     Value *IVOperand) {
00271 
00272   // Fastpath: we don't have any work to do if `BO` is `nuw` and `nsw`.
00273   if (BO->hasNoUnsignedWrap() && BO->hasNoSignedWrap())
00274     return false;
00275 
00276   const SCEV *(ScalarEvolution::*GetExprForBO)(const SCEV *, const SCEV *,
00277                                                SCEV::NoWrapFlags);
00278 
00279   switch (BO->getOpcode()) {
00280   default:
00281     return false;
00282 
00283   case Instruction::Add:
00284     GetExprForBO = &ScalarEvolution::getAddExpr;
00285     break;
00286 
00287   case Instruction::Sub:
00288     GetExprForBO = &ScalarEvolution::getMinusSCEV;
00289     break;
00290 
00291   case Instruction::Mul:
00292     GetExprForBO = &ScalarEvolution::getMulExpr;
00293     break;
00294   }
00295 
00296   unsigned BitWidth = cast<IntegerType>(BO->getType())->getBitWidth();
00297   Type *WideTy = IntegerType::get(BO->getContext(), BitWidth * 2);
00298   const SCEV *LHS = SE->getSCEV(BO->getOperand(0));
00299   const SCEV *RHS = SE->getSCEV(BO->getOperand(1));
00300 
00301   bool Changed = false;
00302 
00303   if (!BO->hasNoUnsignedWrap()) {
00304     const SCEV *ExtendAfterOp = SE->getZeroExtendExpr(SE->getSCEV(BO), WideTy);
00305     const SCEV *OpAfterExtend = (SE->*GetExprForBO)(
00306       SE->getZeroExtendExpr(LHS, WideTy), SE->getZeroExtendExpr(RHS, WideTy),
00307       SCEV::FlagAnyWrap);
00308     if (ExtendAfterOp == OpAfterExtend) {
00309       BO->setHasNoUnsignedWrap();
00310       SE->forgetValue(BO);
00311       Changed = true;
00312     }
00313   }
00314 
00315   if (!BO->hasNoSignedWrap()) {
00316     const SCEV *ExtendAfterOp = SE->getSignExtendExpr(SE->getSCEV(BO), WideTy);
00317     const SCEV *OpAfterExtend = (SE->*GetExprForBO)(
00318       SE->getSignExtendExpr(LHS, WideTy), SE->getSignExtendExpr(RHS, WideTy),
00319       SCEV::FlagAnyWrap);
00320     if (ExtendAfterOp == OpAfterExtend) {
00321       BO->setHasNoSignedWrap();
00322       SE->forgetValue(BO);
00323       Changed = true;
00324     }
00325   }
00326 
00327   return Changed;
00328 }
00329 
00330 /// \brief Split sadd.with.overflow into add + sadd.with.overflow to allow
00331 /// analysis and optimization.
00332 ///
00333 /// \return A new value representing the non-overflowing add if possible,
00334 /// otherwise return the original value.
00335 Instruction *SimplifyIndvar::splitOverflowIntrinsic(Instruction *IVUser,
00336                                                     const DominatorTree *DT) {
00337   IntrinsicInst *II = dyn_cast<IntrinsicInst>(IVUser);
00338   if (!II || II->getIntrinsicID() != Intrinsic::sadd_with_overflow)
00339     return IVUser;
00340 
00341   // Find a branch guarded by the overflow check.
00342   BranchInst *Branch = nullptr;
00343   Instruction *AddVal = nullptr;
00344   for (User *U : II->users()) {
00345     if (ExtractValueInst *ExtractInst = dyn_cast<ExtractValueInst>(U)) {
00346       if (ExtractInst->getNumIndices() != 1)
00347         continue;
00348       if (ExtractInst->getIndices()[0] == 0)
00349         AddVal = ExtractInst;
00350       else if (ExtractInst->getIndices()[0] == 1 && ExtractInst->hasOneUse())
00351         Branch = dyn_cast<BranchInst>(ExtractInst->user_back());
00352     }
00353   }
00354   if (!AddVal || !Branch)
00355     return IVUser;
00356 
00357   BasicBlock *ContinueBB = Branch->getSuccessor(1);
00358   if (std::next(pred_begin(ContinueBB)) != pred_end(ContinueBB))
00359     return IVUser;
00360 
00361   // Check if all users of the add are provably NSW.
00362   bool AllNSW = true;
00363   for (Use &U : AddVal->uses()) {
00364     if (Instruction *UseInst = dyn_cast<Instruction>(U.getUser())) {
00365       BasicBlock *UseBB = UseInst->getParent();
00366       if (PHINode *PHI = dyn_cast<PHINode>(UseInst))
00367         UseBB = PHI->getIncomingBlock(U);
00368       if (!DT->dominates(ContinueBB, UseBB)) {
00369         AllNSW = false;
00370         break;
00371       }
00372     }
00373   }
00374   if (!AllNSW)
00375     return IVUser;
00376 
00377   // Go for it...
00378   IRBuilder<> Builder(IVUser);
00379   Instruction *AddInst = dyn_cast<Instruction>(
00380     Builder.CreateNSWAdd(II->getOperand(0), II->getOperand(1)));
00381 
00382   // The caller expects the new add to have the same form as the intrinsic. The
00383   // IV operand position must be the same.
00384   assert((AddInst->getOpcode() == Instruction::Add &&
00385           AddInst->getOperand(0) == II->getOperand(0)) &&
00386          "Bad add instruction created from overflow intrinsic.");
00387 
00388   AddVal->replaceAllUsesWith(AddInst);
00389   DeadInsts.emplace_back(AddVal);
00390   return AddInst;
00391 }
00392 
00393 /// Add all uses of Def to the current IV's worklist.
00394 static void pushIVUsers(
00395   Instruction *Def,
00396   SmallPtrSet<Instruction*,16> &Simplified,
00397   SmallVectorImpl< std::pair<Instruction*,Instruction*> > &SimpleIVUsers) {
00398 
00399   for (User *U : Def->users()) {
00400     Instruction *UI = cast<Instruction>(U);
00401 
00402     // Avoid infinite or exponential worklist processing.
00403     // Also ensure unique worklist users.
00404     // If Def is a LoopPhi, it may not be in the Simplified set, so check for
00405     // self edges first.
00406     if (UI != Def && Simplified.insert(UI).second)
00407       SimpleIVUsers.push_back(std::make_pair(UI, Def));
00408   }
00409 }
00410 
00411 /// Return true if this instruction generates a simple SCEV
00412 /// expression in terms of that IV.
00413 ///
00414 /// This is similar to IVUsers' isInteresting() but processes each instruction
00415 /// non-recursively when the operand is already known to be a simpleIVUser.
00416 ///
00417 static bool isSimpleIVUser(Instruction *I, const Loop *L, ScalarEvolution *SE) {
00418   if (!SE->isSCEVable(I->getType()))
00419     return false;
00420 
00421   // Get the symbolic expression for this instruction.
00422   const SCEV *S = SE->getSCEV(I);
00423 
00424   // Only consider affine recurrences.
00425   const SCEVAddRecExpr *AR = dyn_cast<SCEVAddRecExpr>(S);
00426   if (AR && AR->getLoop() == L)
00427     return true;
00428 
00429   return false;
00430 }
00431 
00432 /// Iteratively perform simplification on a worklist of users
00433 /// of the specified induction variable. Each successive simplification may push
00434 /// more users which may themselves be candidates for simplification.
00435 ///
00436 /// This algorithm does not require IVUsers analysis. Instead, it simplifies
00437 /// instructions in-place during analysis. Rather than rewriting induction
00438 /// variables bottom-up from their users, it transforms a chain of IVUsers
00439 /// top-down, updating the IR only when it encouters a clear optimization
00440 /// opportunitiy.
00441 ///
00442 /// Once DisableIVRewrite is default, LSR will be the only client of IVUsers.
00443 ///
00444 void SimplifyIndvar::simplifyUsers(PHINode *CurrIV, IVVisitor *V) {
00445   if (!SE->isSCEVable(CurrIV->getType()))
00446     return;
00447 
00448   // Instructions processed by SimplifyIndvar for CurrIV.
00449   SmallPtrSet<Instruction*,16> Simplified;
00450 
00451   // Use-def pairs if IV users waiting to be processed for CurrIV.
00452   SmallVector<std::pair<Instruction*, Instruction*>, 8> SimpleIVUsers;
00453 
00454   // Push users of the current LoopPhi. In rare cases, pushIVUsers may be
00455   // called multiple times for the same LoopPhi. This is the proper thing to
00456   // do for loop header phis that use each other.
00457   pushIVUsers(CurrIV, Simplified, SimpleIVUsers);
00458 
00459   while (!SimpleIVUsers.empty()) {
00460     std::pair<Instruction*, Instruction*> UseOper =
00461       SimpleIVUsers.pop_back_val();
00462     Instruction *UseInst = UseOper.first;
00463 
00464     // Bypass back edges to avoid extra work.
00465     if (UseInst == CurrIV) continue;
00466 
00467     if (V && V->shouldSplitOverflowInstrinsics()) {
00468       UseInst = splitOverflowIntrinsic(UseInst, V->getDomTree());
00469       if (!UseInst)
00470         continue;
00471     }
00472 
00473     Instruction *IVOperand = UseOper.second;
00474     for (unsigned N = 0; IVOperand; ++N) {
00475       assert(N <= Simplified.size() && "runaway iteration");
00476 
00477       Value *NewOper = foldIVUser(UseOper.first, IVOperand);
00478       if (!NewOper)
00479         break; // done folding
00480       IVOperand = dyn_cast<Instruction>(NewOper);
00481     }
00482     if (!IVOperand)
00483       continue;
00484 
00485     if (eliminateIVUser(UseOper.first, IVOperand)) {
00486       pushIVUsers(IVOperand, Simplified, SimpleIVUsers);
00487       continue;
00488     }
00489 
00490     if (BinaryOperator *BO = dyn_cast<BinaryOperator>(UseOper.first)) {
00491       if (isa<OverflowingBinaryOperator>(BO) &&
00492           strengthenOverflowingOperation(BO, IVOperand)) {
00493         // re-queue uses of the now modified binary operator and fall
00494         // through to the checks that remain.
00495         pushIVUsers(IVOperand, Simplified, SimpleIVUsers);
00496       }
00497     }
00498 
00499     CastInst *Cast = dyn_cast<CastInst>(UseOper.first);
00500     if (V && Cast) {
00501       V->visitCast(Cast);
00502       continue;
00503     }
00504     if (isSimpleIVUser(UseOper.first, L, SE)) {
00505       pushIVUsers(UseOper.first, Simplified, SimpleIVUsers);
00506     }
00507   }
00508 }
00509 
00510 namespace llvm {
00511 
00512 void IVVisitor::anchor() { }
00513 
00514 /// Simplify instructions that use this induction variable
00515 /// by using ScalarEvolution to analyze the IV's recurrence.
00516 bool simplifyUsersOfIV(PHINode *CurrIV, ScalarEvolution *SE, LPPassManager *LPM,
00517                        SmallVectorImpl<WeakVH> &Dead, IVVisitor *V)
00518 {
00519   LoopInfo *LI = &LPM->getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
00520   SimplifyIndvar SIV(LI->getLoopFor(CurrIV->getParent()), SE, LI, Dead);
00521   SIV.simplifyUsers(CurrIV, V);
00522   return SIV.hasChanged();
00523 }
00524 
00525 /// Simplify users of induction variables within this
00526 /// loop. This does not actually change or add IVs.
00527 bool simplifyLoopIVs(Loop *L, ScalarEvolution *SE, LPPassManager *LPM,
00528                      SmallVectorImpl<WeakVH> &Dead) {
00529   bool Changed = false;
00530   for (BasicBlock::iterator I = L->getHeader()->begin(); isa<PHINode>(I); ++I) {
00531     Changed |= simplifyUsersOfIV(cast<PHINode>(I), SE, LPM, Dead);
00532   }
00533   return Changed;
00534 }
00535 
00536 } // namespace llvm