// The functions below can be called after we've finished processing all
// instructions in the loop, and we know which reductions were selected.
- // Is the provided instruction the PHI of a reduction selected for
- // rerolling?
- bool isSelectedPHI(Instruction *J) {
- if (!isa<PHINode>(J))
- return false;
-
- for (DenseSet<int>::iterator RI = Reds.begin(), RIE = Reds.end();
- RI != RIE; ++RI) {
- int i = *RI;
- if (cast<Instruction>(J) == PossibleReds[i].getPHI())
- return true;
- }
-
- return false;
- }
-
bool validateSelected();
void replaceSelected();
continue;
if (const SCEVAddRecExpr *PHISCEV =
- dyn_cast<SCEVAddRecExpr>(SE->getSCEV(I))) {
+ dyn_cast<SCEVAddRecExpr>(SE->getSCEV(&*I))) {
if (PHISCEV->getLoop() != L)
continue;
if (!PHISCEV->isAffine())
const APInt &AInt = IncSCEV->getValue()->getValue().abs();
if (IncSCEV->getValue()->isZero() || AInt.uge(MaxInc))
continue;
- IVToIncMap[I] = IncSCEV->getValue()->getSExtValue();
+ IVToIncMap[&*I] = IncSCEV->getValue()->getSExtValue();
DEBUG(dbgs() << "LRR: Possible IV: " << *I << " = " << *PHISCEV
<< "\n");
- PossibleIVs.push_back(I);
+ PossibleIVs.push_back(&*I);
}
}
}
if (!I->getType()->isSingleValueType())
continue;
- SimpleLoopReduction SLR(I, L);
+ SimpleLoopReduction SLR(&*I, L);
if (!SLR.valid())
continue;
SCEV::FlagAnyWrap));
{ // Limit the lifetime of SCEVExpander.
SCEVExpander Expander(*SE, DL, "reroll");
- Value *NewIV = Expander.expandCodeFor(H, IV->getType(), Header->begin());
+ Value *NewIV = Expander.expandCodeFor(H, IV->getType(), &Header->front());
for (auto &KV : Uses) {
if (KV.second.find_first() == 0)