|
@@ -744,7 +744,7 @@ static bool isExistingPhi(const SCEVAddRecExpr *AR, ScalarEvolution &SE) {
|
|
/// TODO: Allow UDivExpr if we can find an existing IV increment that is an
|
|
/// TODO: Allow UDivExpr if we can find an existing IV increment that is an
|
|
/// obvious multiple of the UDivExpr.
|
|
/// obvious multiple of the UDivExpr.
|
|
static bool isHighCostExpansion(const SCEV *S,
|
|
static bool isHighCostExpansion(const SCEV *S,
|
|
- SmallPtrSet<const SCEV*, 8> &Processed,
|
|
|
|
|
|
+ SmallPtrSetImpl<const SCEV*> &Processed,
|
|
ScalarEvolution &SE) {
|
|
ScalarEvolution &SE) {
|
|
// Zero/One operand expressions
|
|
// Zero/One operand expressions
|
|
switch (S->getSCEVType()) {
|
|
switch (S->getSCEVType()) {
|
|
@@ -892,34 +892,34 @@ public:
|
|
|
|
|
|
void RateFormula(const TargetTransformInfo &TTI,
|
|
void RateFormula(const TargetTransformInfo &TTI,
|
|
const Formula &F,
|
|
const Formula &F,
|
|
- SmallPtrSet<const SCEV *, 16> &Regs,
|
|
|
|
|
|
+ SmallPtrSetImpl<const SCEV *> &Regs,
|
|
const DenseSet<const SCEV *> &VisitedRegs,
|
|
const DenseSet<const SCEV *> &VisitedRegs,
|
|
const Loop *L,
|
|
const Loop *L,
|
|
const SmallVectorImpl<int64_t> &Offsets,
|
|
const SmallVectorImpl<int64_t> &Offsets,
|
|
ScalarEvolution &SE, DominatorTree &DT,
|
|
ScalarEvolution &SE, DominatorTree &DT,
|
|
const LSRUse &LU,
|
|
const LSRUse &LU,
|
|
- SmallPtrSet<const SCEV *, 16> *LoserRegs = nullptr);
|
|
|
|
|
|
+ SmallPtrSetImpl<const SCEV *> *LoserRegs = nullptr);
|
|
|
|
|
|
void print(raw_ostream &OS) const;
|
|
void print(raw_ostream &OS) const;
|
|
void dump() const;
|
|
void dump() const;
|
|
|
|
|
|
private:
|
|
private:
|
|
void RateRegister(const SCEV *Reg,
|
|
void RateRegister(const SCEV *Reg,
|
|
- SmallPtrSet<const SCEV *, 16> &Regs,
|
|
|
|
|
|
+ SmallPtrSetImpl<const SCEV *> &Regs,
|
|
const Loop *L,
|
|
const Loop *L,
|
|
ScalarEvolution &SE, DominatorTree &DT);
|
|
ScalarEvolution &SE, DominatorTree &DT);
|
|
void RatePrimaryRegister(const SCEV *Reg,
|
|
void RatePrimaryRegister(const SCEV *Reg,
|
|
- SmallPtrSet<const SCEV *, 16> &Regs,
|
|
|
|
|
|
+ SmallPtrSetImpl<const SCEV *> &Regs,
|
|
const Loop *L,
|
|
const Loop *L,
|
|
ScalarEvolution &SE, DominatorTree &DT,
|
|
ScalarEvolution &SE, DominatorTree &DT,
|
|
- SmallPtrSet<const SCEV *, 16> *LoserRegs);
|
|
|
|
|
|
+ SmallPtrSetImpl<const SCEV *> *LoserRegs);
|
|
};
|
|
};
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/// RateRegister - Tally up interesting quantities from the given register.
|
|
/// RateRegister - Tally up interesting quantities from the given register.
|
|
void Cost::RateRegister(const SCEV *Reg,
|
|
void Cost::RateRegister(const SCEV *Reg,
|
|
- SmallPtrSet<const SCEV *, 16> &Regs,
|
|
|
|
|
|
+ SmallPtrSetImpl<const SCEV *> &Regs,
|
|
const Loop *L,
|
|
const Loop *L,
|
|
ScalarEvolution &SE, DominatorTree &DT) {
|
|
ScalarEvolution &SE, DominatorTree &DT) {
|
|
if (const SCEVAddRecExpr *AR = dyn_cast<SCEVAddRecExpr>(Reg)) {
|
|
if (const SCEVAddRecExpr *AR = dyn_cast<SCEVAddRecExpr>(Reg)) {
|
|
@@ -967,10 +967,10 @@ void Cost::RateRegister(const SCEV *Reg,
|
|
/// before, rate it. Optional LoserRegs provides a way to declare any formula
|
|
/// before, rate it. Optional LoserRegs provides a way to declare any formula
|
|
/// that refers to one of those regs an instant loser.
|
|
/// that refers to one of those regs an instant loser.
|
|
void Cost::RatePrimaryRegister(const SCEV *Reg,
|
|
void Cost::RatePrimaryRegister(const SCEV *Reg,
|
|
- SmallPtrSet<const SCEV *, 16> &Regs,
|
|
|
|
|
|
+ SmallPtrSetImpl<const SCEV *> &Regs,
|
|
const Loop *L,
|
|
const Loop *L,
|
|
ScalarEvolution &SE, DominatorTree &DT,
|
|
ScalarEvolution &SE, DominatorTree &DT,
|
|
- SmallPtrSet<const SCEV *, 16> *LoserRegs) {
|
|
|
|
|
|
+ SmallPtrSetImpl<const SCEV *> *LoserRegs) {
|
|
if (LoserRegs && LoserRegs->count(Reg)) {
|
|
if (LoserRegs && LoserRegs->count(Reg)) {
|
|
Lose();
|
|
Lose();
|
|
return;
|
|
return;
|
|
@@ -984,13 +984,13 @@ void Cost::RatePrimaryRegister(const SCEV *Reg,
|
|
|
|
|
|
void Cost::RateFormula(const TargetTransformInfo &TTI,
|
|
void Cost::RateFormula(const TargetTransformInfo &TTI,
|
|
const Formula &F,
|
|
const Formula &F,
|
|
- SmallPtrSet<const SCEV *, 16> &Regs,
|
|
|
|
|
|
+ SmallPtrSetImpl<const SCEV *> &Regs,
|
|
const DenseSet<const SCEV *> &VisitedRegs,
|
|
const DenseSet<const SCEV *> &VisitedRegs,
|
|
const Loop *L,
|
|
const Loop *L,
|
|
const SmallVectorImpl<int64_t> &Offsets,
|
|
const SmallVectorImpl<int64_t> &Offsets,
|
|
ScalarEvolution &SE, DominatorTree &DT,
|
|
ScalarEvolution &SE, DominatorTree &DT,
|
|
const LSRUse &LU,
|
|
const LSRUse &LU,
|
|
- SmallPtrSet<const SCEV *, 16> *LoserRegs) {
|
|
|
|
|
|
+ SmallPtrSetImpl<const SCEV *> *LoserRegs) {
|
|
assert(F.isCanonical() && "Cost is accurate only for canonical formula");
|
|
assert(F.isCanonical() && "Cost is accurate only for canonical formula");
|
|
// Tally up the registers.
|
|
// Tally up the registers.
|
|
if (const SCEV *ScaledReg = F.ScaledReg) {
|
|
if (const SCEV *ScaledReg = F.ScaledReg) {
|
|
@@ -2557,7 +2557,7 @@ bool IVChain::isProfitableIncrement(const SCEV *OperExpr,
|
|
///
|
|
///
|
|
/// TODO: Consider IVInc free if it's already used in another chains.
|
|
/// TODO: Consider IVInc free if it's already used in another chains.
|
|
static bool
|
|
static bool
|
|
-isProfitableChain(IVChain &Chain, SmallPtrSet<Instruction*, 4> &Users,
|
|
|
|
|
|
+isProfitableChain(IVChain &Chain, SmallPtrSetImpl<Instruction*> &Users,
|
|
ScalarEvolution &SE, const TargetTransformInfo &TTI) {
|
|
ScalarEvolution &SE, const TargetTransformInfo &TTI) {
|
|
if (StressIVChain)
|
|
if (StressIVChain)
|
|
return true;
|
|
return true;
|