mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-09 11:25:55 +00:00
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
This commit is contained in:
@@ -19,6 +19,7 @@
|
|||||||
#include "llvm/Transforms/Scalar.h"
|
#include "llvm/Transforms/Scalar.h"
|
||||||
#include "llvm/Constants.h"
|
#include "llvm/Constants.h"
|
||||||
#include "llvm/Instructions.h"
|
#include "llvm/Instructions.h"
|
||||||
|
#include "llvm/Intrinsics.h"
|
||||||
#include "llvm/Type.h"
|
#include "llvm/Type.h"
|
||||||
#include "llvm/DerivedTypes.h"
|
#include "llvm/DerivedTypes.h"
|
||||||
#include "llvm/Analysis/Dominators.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
|
// Addressing modes can be folded into loads and stores. Be careful that
|
||||||
// the store is through the expression, not of the expression though.
|
// the store is through the expression, not of the expression though.
|
||||||
bool isAddress = isa<LoadInst>(UsersToProcess[i].Inst);
|
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)
|
if (SI->getOperand(1) == UsersToProcess[i].OperandValToReplace)
|
||||||
isAddress = true;
|
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,
|
MoveImmediateValues(TLI, UsersToProcess[i].Inst, UsersToProcess[i].Base,
|
||||||
UsersToProcess[i].Imm, isAddress, L);
|
UsersToProcess[i].Imm, isAddress, L);
|
||||||
|
Reference in New Issue
Block a user