diff options
author | Dan Gohman <gohman@apple.com> | 2010-10-08 19:33:26 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-10-08 19:33:26 +0000 |
commit | 2fd85d7cd2c77d948e10d65c8e468ea1c0865b54 (patch) | |
tree | 10a15df846b811d281e07b63f095a159a4783057 /llvm/lib/Transforms | |
parent | a5af410dc55d73a0442e2898403aefc84e17e65d (diff) | |
download | bcm5719-llvm-2fd85d7cd2c77d948e10d65c8e468ea1c0865b54.tar.gz bcm5719-llvm-2fd85d7cd2c77d948e10d65c8e468ea1c0865b54.zip |
Filter out illegal formulae after updating offsets, not before, so that
formulae which become illegal as a result of the offset updating don't
escape.
This is for rdar://8529692. No testcase yet, because the given cases
hit use-list ordering differences.
llvm-svn: 116093
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 337adf06d73..5b608a0dcd5 100644 --- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -2992,24 +2992,6 @@ void LSRInstance::NarrowSearchSpaceByCollapsingUnrolledCode() { LUThatHas->AllFixupsOutsideLoop &= LU.AllFixupsOutsideLoop; - // Delete formulae from the new use which are no longer legal. - bool Any = false; - for (size_t i = 0, e = LUThatHas->Formulae.size(); i != e; ++i) { - Formula &F = LUThatHas->Formulae[i]; - if (!isLegalUse(F.AM, - LUThatHas->MinOffset, LUThatHas->MaxOffset, - LUThatHas->Kind, LUThatHas->AccessTy, TLI)) { - DEBUG(dbgs() << " Deleting "; F.print(dbgs()); - dbgs() << '\n'); - LUThatHas->DeleteFormula(F); - --i; - --e; - Any = true; - } - } - if (Any) - LUThatHas->RecomputeRegs(LUThatHas - &Uses.front(), RegUses); - // Update the relocs to reference the new use. for (SmallVectorImpl<LSRFixup>::iterator I = Fixups.begin(), E = Fixups.end(); I != E; ++I) { @@ -3032,6 +3014,24 @@ void LSRInstance::NarrowSearchSpaceByCollapsingUnrolledCode() { Fixup.LUIdx = LUIdx; } + // Delete formulae from the new use which are no longer legal. + bool Any = false; + for (size_t i = 0, e = LUThatHas->Formulae.size(); i != e; ++i) { + Formula &F = LUThatHas->Formulae[i]; + if (!isLegalUse(F.AM, + LUThatHas->MinOffset, LUThatHas->MaxOffset, + LUThatHas->Kind, LUThatHas->AccessTy, TLI)) { + DEBUG(dbgs() << " Deleting "; F.print(dbgs()); + dbgs() << '\n'); + LUThatHas->DeleteFormula(F); + --i; + --e; + Any = true; + } + } + if (Any) + LUThatHas->RecomputeRegs(LUThatHas - &Uses.front(), RegUses); + // Delete the old use. DeleteUse(LU, LUIdx); --LUIdx; |