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 | 2acc7601650654d03cd53faeece8d7685a203105 (patch) | |
tree | 93da75351ae4371e83c4981568e39131a2e9b2b5 /lib/Transforms | |
parent | 50954f5cba406a88011cc8ade3ceb4235830f907 (diff) | |
download | llvm-2acc7601650654d03cd53faeece8d7685a203105.tar.gz llvm-2acc7601650654d03cd53faeece8d7685a203105.tar.bz2 llvm-2acc7601650654d03cd53faeece8d7685a203105.tar.xz |
Allow strength reduction to make use of addressing modes for the
address operand in a prefetch intrinsic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36713 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/Scalar/LoopStrengthReduce.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index bf0484c292..652b39f4c6 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/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); |