mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-19 13:38:56 +00:00
Reapply r207271 without the testcase
PR19608 was filed to find a suitable testcase. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207569 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
52c03fbb3b
commit
1363a7718b
@ -256,7 +256,7 @@ struct Formula {
|
|||||||
|
|
||||||
void InitialMatch(const SCEV *S, Loop *L, ScalarEvolution &SE);
|
void InitialMatch(const SCEV *S, Loop *L, ScalarEvolution &SE);
|
||||||
|
|
||||||
unsigned getNumRegs() const;
|
size_t getNumRegs() const;
|
||||||
Type *getType() const;
|
Type *getType() const;
|
||||||
|
|
||||||
void DeleteBaseReg(const SCEV *&S);
|
void DeleteBaseReg(const SCEV *&S);
|
||||||
@ -351,7 +351,7 @@ void Formula::InitialMatch(const SCEV *S, Loop *L, ScalarEvolution &SE) {
|
|||||||
/// getNumRegs - Return the total number of register operands used by this
|
/// getNumRegs - Return the total number of register operands used by this
|
||||||
/// formula. This does not include register uses implied by non-constant
|
/// formula. This does not include register uses implied by non-constant
|
||||||
/// addrec strides.
|
/// addrec strides.
|
||||||
unsigned Formula::getNumRegs() const {
|
size_t Formula::getNumRegs() const {
|
||||||
return !!ScaledReg + BaseRegs.size();
|
return !!ScaledReg + BaseRegs.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4132,19 +4132,22 @@ void LSRInstance::SolveRecurse(SmallVectorImpl<const Formula *> &Solution,
|
|||||||
E = LU.Formulae.end(); I != E; ++I) {
|
E = LU.Formulae.end(); I != E; ++I) {
|
||||||
const Formula &F = *I;
|
const Formula &F = *I;
|
||||||
|
|
||||||
// Ignore formulae which do not use any of the required registers.
|
// Ignore formulae which may not be ideal in terms of register reuse of
|
||||||
bool SatisfiedReqReg = true;
|
// ReqRegs. The formula should use all required registers before
|
||||||
|
// introducing new ones.
|
||||||
|
int NumReqRegsToFind = std::min(F.getNumRegs(), ReqRegs.size());
|
||||||
for (SmallSetVector<const SCEV *, 4>::const_iterator J = ReqRegs.begin(),
|
for (SmallSetVector<const SCEV *, 4>::const_iterator J = ReqRegs.begin(),
|
||||||
JE = ReqRegs.end(); J != JE; ++J) {
|
JE = ReqRegs.end(); J != JE; ++J) {
|
||||||
const SCEV *Reg = *J;
|
const SCEV *Reg = *J;
|
||||||
if ((!F.ScaledReg || F.ScaledReg != Reg) &&
|
if ((F.ScaledReg && F.ScaledReg == Reg) ||
|
||||||
std::find(F.BaseRegs.begin(), F.BaseRegs.end(), Reg) ==
|
std::find(F.BaseRegs.begin(), F.BaseRegs.end(), Reg) !=
|
||||||
F.BaseRegs.end()) {
|
F.BaseRegs.end()) {
|
||||||
SatisfiedReqReg = false;
|
--NumReqRegsToFind;
|
||||||
break;
|
if (NumReqRegsToFind == 0)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!SatisfiedReqReg) {
|
if (NumReqRegsToFind != 0) {
|
||||||
// If none of the formulae satisfied the required registers, then we could
|
// If none of the formulae satisfied the required registers, then we could
|
||||||
// clear ReqRegs and try again. Currently, we simply give up in this case.
|
// clear ReqRegs and try again. Currently, we simply give up in this case.
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user