Deleted Added
sdiff udiff text old ( 193323 ) new ( 193574 )
full compact
1//===- ScalarEvolution.cpp - Scalar Evolution Analysis ----------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//

--- 66 unchanged lines hidden (view full) ---

75#include "llvm/Support/ConstantRange.h"
76#include "llvm/Support/GetElementPtrTypeIterator.h"
77#include "llvm/Support/InstIterator.h"
78#include "llvm/Support/ManagedStatic.h"
79#include "llvm/Support/MathExtras.h"
80#include "llvm/Support/raw_ostream.h"
81#include "llvm/ADT/Statistic.h"
82#include "llvm/ADT/STLExtras.h"
83#include <algorithm>
84using namespace llvm;
85
86STATISTIC(NumArrayLenItCounts,
87 "Number of trip counts computed with array length");
88STATISTIC(NumTripCountsComputed,
89 "Number of loops with predictable loop counts");
90STATISTIC(NumTripCountsNotComputed,

--- 2366 unchanged lines hidden (view full) ---

2457 }
2458}
2459
2460/// ComputeBackedgeTakenCount - Compute the number of times the backedge
2461/// of the specified loop will execute.
2462ScalarEvolution::BackedgeTakenInfo
2463ScalarEvolution::ComputeBackedgeTakenCount(const Loop *L) {
2464 // If the loop has a non-one exit block count, we can't analyze it.
2465 BasicBlock *ExitBlock = L->getExitBlock();
2466 if (!ExitBlock)
2467 return UnknownValue;
2468
2469 // Okay, there is one exit block. Try to find the condition that causes the
2470 // loop to be exited.
2471 BasicBlock *ExitingBlock = L->getExitingBlock();
2472 if (!ExitingBlock)
2473 return UnknownValue; // More than one block exiting!
2474
2475 // Okay, we've computed the exiting block. See what condition causes us to
2476 // exit.
2477 //
2478 // FIXME: we should be able to handle switch instructions (with a single exit)
2479 BranchInst *ExitBr = dyn_cast<BranchInst>(ExitingBlock->getTerminator());
2480 if (ExitBr == 0) return UnknownValue;
2481 assert(ExitBr->isConditional() && "If unconditional, it can't be in loop!");
2482

--- 1332 unchanged lines hidden ---