[llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
Dan Gohman
djg at cray.com
Thu May 3 16:20:50 PDT 2007
Changes in directory llvm/lib/Transforms/Scalar:
LoopStrengthReduce.cpp updated: 1.134 -> 1.135
---
Log message:
Allow strength reduction to make use of addressing modes for the
address operand in a prefetch intrinsic.
---
Diffs of the changes: (+10 -1)
LoopStrengthReduce.cpp | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletion(-)
Index: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
diff -u llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.134 llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.135
--- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.134 Wed May 2 20:11:54 2007
+++ llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp Thu May 3 18:20:33 2007
@@ -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 @@
// 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);
More information about the llvm-commits
mailing list