diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2014-04-28 23:07:49 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2014-04-28 23:07:49 +0000 |
commit | c71b2c3c7f7d0c6a31701b797f87855e10b9000d (patch) | |
tree | 62fa2fce5dd9b2770d59b6fced4272b6933892eb /llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp | |
parent | a08b1619701010fdfca660fe2f223d6b1b5d955e (diff) | |
download | bcm5719-llvm-c71b2c3c7f7d0c6a31701b797f87855e10b9000d.tar.gz bcm5719-llvm-c71b2c3c7f7d0c6a31701b797f87855e10b9000d.zip |
Revert r207271 for now. This commit introduced a test case that ran
clang directly from the LLVM test suite! That doesn't work. I've
followed up on the review thread to try and get a viable solution sorted
out, but trying to get the tree clean here.
llvm-svn: 207462
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 13e4fceec66..16a001ad934 100644 --- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -256,7 +256,7 @@ struct Formula { void InitialMatch(const SCEV *S, Loop *L, ScalarEvolution &SE); - size_t getNumRegs() const; + unsigned getNumRegs() const; Type *getType() const; 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 /// formula. This does not include register uses implied by non-constant /// addrec strides. -size_t Formula::getNumRegs() const { +unsigned Formula::getNumRegs() const { return !!ScaledReg + BaseRegs.size(); } @@ -4132,22 +4132,19 @@ void LSRInstance::SolveRecurse(SmallVectorImpl<const Formula *> &Solution, E = LU.Formulae.end(); I != E; ++I) { const Formula &F = *I; - // Ignore formulae which may not be ideal in terms of register reuse of - // ReqRegs. The formula should use all required registers before - // introducing new ones. - int NumReqRegsToFind = std::min(F.getNumRegs(), ReqRegs.size()); + // Ignore formulae which do not use any of the required registers. + bool SatisfiedReqReg = true; for (SmallSetVector<const SCEV *, 4>::const_iterator J = ReqRegs.begin(), JE = ReqRegs.end(); J != JE; ++J) { const SCEV *Reg = *J; - if ((F.ScaledReg && F.ScaledReg == Reg) || - std::find(F.BaseRegs.begin(), F.BaseRegs.end(), Reg) != + if ((!F.ScaledReg || F.ScaledReg != Reg) && + std::find(F.BaseRegs.begin(), F.BaseRegs.end(), Reg) == F.BaseRegs.end()) { - --NumReqRegsToFind; - if (NumReqRegsToFind == 0) - break; + SatisfiedReqReg = false; + break; } } - if (NumReqRegsToFind != 0) { + if (!SatisfiedReqReg) { // 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. continue; |