diff options
author | Dan Gohman <djg@cray.com> | 2007-10-29 19:23:53 +0000 |
---|---|---|
committer | Dan Gohman <djg@cray.com> | 2007-10-29 19:23:53 +0000 |
commit | 55113947852c62178bb2ce3e1734a135a18c16e9 (patch) | |
tree | f9dfe08031935ce146df401a5efb7cd90d2012d9 /lib | |
parent | 33ca234df5ca97402e64053cf1b11e5bcc483551 (diff) | |
download | external_llvm-55113947852c62178bb2ce3e1734a135a18c16e9.zip external_llvm-55113947852c62178bb2ce3e1734a135a18c16e9.tar.gz external_llvm-55113947852c62178bb2ce3e1734a135a18c16e9.tar.bz2 |
Avoid calling ValidStride when not all uses are addresses.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43460 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/Scalar/LoopStrengthReduce.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 9c955a9..e384508 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -1013,15 +1013,14 @@ unsigned LoopStrengthReduce::CheckForIVReuse(bool HasBaseReg, (unsigned(abs(SInt)) < SSInt || (SInt % SSInt) != 0)) continue; int64_t Scale = SInt / SSInt; - // When scale is 1, we don't need to worry about whether the - // multiplication can be folded into the addressing mode. - if (!AllUsesAreAddresses && Scale != 1) - continue; // Check that this stride is valid for all the types used for loads and // stores; if it can be used for some and not others, we might as well use // the original stride everywhere, since we have to create the IV for it - // anyway. - if (ValidStride(HasBaseReg, Scale, UsersToProcess)) + // anyway. If the scale is 1, then we don't need to worry about folding + // multiplications. + if (Scale == 1 || + (AllUsesAreAddresses && + ValidStride(HasBaseReg, Scale, UsersToProcess))) for (std::vector<IVExpr>::iterator II = SI->second.IVs.begin(), IE = SI->second.IVs.end(); II != IE; ++II) // FIXME: Only handle base == 0 for now. |