Use IntrinsicInst to test for prefetch instructions, which is ever so

slightly nicer than using CallInst with an extra check; thanks Chris.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36743 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman 2007-05-04 14:59:09 +00:00
parent 6da91d3c2c
commit e5b01bea7b

View File

@ -19,7 +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/IntrinsicInst.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"
@ -1043,12 +1043,11 @@ void LoopStrengthReduce::StrengthReduceStridedIVUsers(const SCEVHandle &Stride,
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)) { } else if (IntrinsicInst *II =
dyn_cast<IntrinsicInst>(UsersToProcess[i].Inst)) {
// Addressing modes can also be folded into prefetches. // Addressing modes can also be folded into prefetches.
Function *CalledFunc = CI->getCalledFunction(); if (II->getIntrinsicID() == Intrinsic::prefetch &&
if (CalledFunc != NULL && II->getOperand(1) == UsersToProcess[i].OperandValToReplace)
CalledFunc->getIntrinsicID() == Intrinsic::prefetch &&
CI->getOperand(1) == UsersToProcess[i].OperandValToReplace)
isAddress = true; isAddress = true;
} }