llvm.org GIT mirror llvm / 45a2d7d
recommit 96626, evidence that it broke things appears to be spurious git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96662 91177308-0d34-0410-b5e6-96231b3b80d8 Dale Johannesen 10 years ago
3 changed file(s) with 41 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
585585 /// compute a trip count, or if the loop is deleted.
586586 void forgetLoop(const Loop *L);
587587
588 /// forgetValue - This method should be called by the client when it has
589 /// changed a value in a way that may effect its value, or which may
590 /// disconnect it from a def-use chain linking it to a loop.
591 void forgetValue(Value *V);
592
588593 /// GetMinTrailingZeros - Determine the minimum number of zero bits that S
589594 /// is guaranteed to end in (at every loop iteration). It is, at the same
590595 /// time, the minimum number of times S is divisible by 2. For example,
34843484 }
34853485 }
34863486
3487 /// forgetValue - This method should be called by the client when it has
3488 /// changed a value in a way that may effect its value, or which may
3489 /// disconnect it from a def-use chain linking it to a loop.
3490 void ScalarEvolution::forgetValue(Value *V) {
3491 Instruction *I = dyn_cast(V);
3492 if (!I) return;
3493
3494 // Drop information about expressions based on loop-header PHIs.
3495 SmallVector Worklist;
3496 Worklist.push_back(I);
3497
3498 SmallPtrSet Visited;
3499 while (!Worklist.empty()) {
3500 I = Worklist.pop_back_val();
3501 if (!Visited.insert(I)) continue;
3502
3503 std::map::iterator It =
3504 Scalars.find(static_cast(I));
3505 if (It != Scalars.end()) {
3506 ValuesAtScopes.erase(It->second);
3507 Scalars.erase(It);
3508 if (PHINode *PN = dyn_cast(I))
3509 ConstantEvolutionLoopExitValue.erase(PN);
3510 }
3511
3512 PushDefUseChildren(I, Worklist);
3513 }
3514 }
3515
34873516 /// ComputeBackedgeTakenCount - Compute the number of times the backedge
34883517 /// of the specified loop will execute.
34893518 ScalarEvolution::BackedgeTakenInfo
244244 // SCEV only supports integer expressions for now.
245245 if (!PN->getType()->isIntegerTy() && !PN->getType()->isPointerTy())
246246 continue;
247
248 // It's necessary to tell ScalarEvolution about this explicitly so that
249 // it can walk the def-use list and forget all SCEVs, as it may not be
250 // watching the PHI itself. Once the new exit value is in place, there
251 // may not be a def-use connection between the loop and every instruction
252 // which got a SCEVAddRecExpr for that loop.
253 SE->forgetValue(PN);
247254
248255 // Iterate over all of the values in all the PHI nodes.
249256 for (unsigned i = 0; i != NumPreds; ++i) {