diff options
| author | Dan Gohman <gohman@apple.com> | 2007-05-03 23:20:33 +0000 |
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2007-05-03 23:20:33 +0000 |
| commit | 3fbb18d1b60c556e8b36a81d5c8d652d4aeb0d39 (patch) | |
| tree | cea68401d6aaba262ae24131bf9e4733a5c77bd9 /llvm/lib/Transforms | |
| parent | e4bbad630fb0c534b5d4f2ba8a41e518b62f1537 (diff) | |
| download | bcm5719-llvm-3fbb18d1b60c556e8b36a81d5c8d652d4aeb0d39.tar.gz bcm5719-llvm-3fbb18d1b60c556e8b36a81d5c8d652d4aeb0d39.zip | |
Allow strength reduction to make use of addressing modes for the
address operand in a prefetch intrinsic.
llvm-svn: 36713
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp index bf0484c292c..652b39f4c64 100644 --- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -19,6 +19,7 @@ #include "llvm/Transforms/Scalar.h" #include "llvm/Constants.h" #include "llvm/Instructions.h" +#include "llvm/Intrinsics.h" #include "llvm/Type.h" #include "llvm/DerivedTypes.h" #include "llvm/Analysis/Dominators.h" @@ -1039,9 +1040,17 @@ void LoopStrengthReduce::StrengthReduceStridedIVUsers(const SCEVHandle &Stride, // Addressing modes can be folded into loads and stores. Be careful that // the store is through the expression, not of the expression though. bool isAddress = isa<LoadInst>(UsersToProcess[i].Inst); - if (StoreInst *SI = dyn_cast<StoreInst>(UsersToProcess[i].Inst)) + if (StoreInst *SI = dyn_cast<StoreInst>(UsersToProcess[i].Inst)) { if (SI->getOperand(1) == UsersToProcess[i].OperandValToReplace) isAddress = true; + } else if (CallInst *CI = dyn_cast<CallInst>(UsersToProcess[i].Inst)) { + // Addressing modes can also be folded into prefetches. + Function *CalledFunc = CI->getCalledFunction(); + if (CalledFunc != NULL && + CalledFunc->getIntrinsicID() == Intrinsic::prefetch && + CI->getOperand(1) == UsersToProcess[i].OperandValToReplace) + isAddress = true; + } MoveImmediateValues(TLI, UsersToProcess[i].Inst, UsersToProcess[i].Base, UsersToProcess[i].Imm, isAddress, L); |

