diff options
author | Renato Golin <renato.golin@linaro.org> | 2018-03-09 21:05:58 +0000 |
---|---|---|
committer | Renato Golin <renato.golin@linaro.org> | 2018-03-09 21:05:58 +0000 |
commit | 038ede2a16a55106ada3970265037ba0327385bb (patch) | |
tree | e439d0f35ec332982fbb7f1411cd6081b96c32de /llvm/lib/Analysis/DependenceAnalysis.cpp | |
parent | 0fab41782ddc6479602b496e72f7c86700a1d602 (diff) | |
download | bcm5719-llvm-038ede2a16a55106ada3970265037ba0327385bb.tar.gz bcm5719-llvm-038ede2a16a55106ada3970265037ba0327385bb.zip |
[NFC] Consolidate six getPointerOperand() utility functions into one place
There are six separate instances of getPointerOperand() utility.
LoopVectorize.cpp has one of them,
and I don't want to create a 7th one while I'm trying to move
LoopVectorizationLegality into a separate file
(eventual objective is to move it to Analysis tree).
See http://lists.llvm.org/pipermail/llvm-dev/2018-February/120999.html
for llvm-dev discussions
Closes D43323.
Patch by Hideki Saito <hideki.saito@intel.com>.
llvm-svn: 327173
Diffstat (limited to 'llvm/lib/Analysis/DependenceAnalysis.cpp')
-rw-r--r-- | llvm/lib/Analysis/DependenceAnalysis.cpp | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/llvm/lib/Analysis/DependenceAnalysis.cpp b/llvm/lib/Analysis/DependenceAnalysis.cpp index 0d89bbd4eba..b63ec2772e4 100644 --- a/llvm/lib/Analysis/DependenceAnalysis.cpp +++ b/llvm/lib/Analysis/DependenceAnalysis.cpp @@ -643,17 +643,6 @@ bool isLoadOrStore(const Instruction *I) { } -static -Value *getPointerOperand(Instruction *I) { - if (LoadInst *LI = dyn_cast<LoadInst>(I)) - return LI->getPointerOperand(); - if (StoreInst *SI = dyn_cast<StoreInst>(I)) - return SI->getPointerOperand(); - llvm_unreachable("Value is not load or store instruction"); - return nullptr; -} - - // Examines the loop nesting of the Src and Dst // instructions and establishes their shared loops. Sets the variables // CommonLevels, SrcLevels, and MaxLevels. @@ -3176,8 +3165,10 @@ void DependenceInfo::updateDirection(Dependence::DVEntry &Level, /// for each loop level. bool DependenceInfo::tryDelinearize(Instruction *Src, Instruction *Dst, SmallVectorImpl<Subscript> &Pair) { - Value *SrcPtr = getPointerOperand(Src); - Value *DstPtr = getPointerOperand(Dst); + assert(isLoadOrStore(Src) && "instruction is not load or store"); + assert(isLoadOrStore(Dst) && "instruction is not load or store"); + Value *SrcPtr = getLoadStorePointerOperand(Src); + Value *DstPtr = getLoadStorePointerOperand(Dst); Loop *SrcLoop = LI->getLoopFor(Src->getParent()); Loop *DstLoop = LI->getLoopFor(Dst->getParent()); @@ -3302,8 +3293,10 @@ DependenceInfo::depends(Instruction *Src, Instruction *Dst, return make_unique<Dependence>(Src, Dst); } - Value *SrcPtr = getPointerOperand(Src); - Value *DstPtr = getPointerOperand(Dst); + assert(isLoadOrStore(Src) && "instruction is not load or store"); + assert(isLoadOrStore(Dst) && "instruction is not load or store"); + Value *SrcPtr = getLoadStorePointerOperand(Src); + Value *DstPtr = getLoadStorePointerOperand(Dst); switch (underlyingObjectsAlias(AA, F->getParent()->getDataLayout(), DstPtr, SrcPtr)) { @@ -3720,8 +3713,8 @@ const SCEV *DependenceInfo::getSplitIteration(const Dependence &Dep, assert(Dst->mayReadFromMemory() || Dst->mayWriteToMemory()); assert(isLoadOrStore(Src)); assert(isLoadOrStore(Dst)); - Value *SrcPtr = getPointerOperand(Src); - Value *DstPtr = getPointerOperand(Dst); + Value *SrcPtr = getLoadStorePointerOperand(Src); + Value *DstPtr = getLoadStorePointerOperand(Dst); assert(underlyingObjectsAlias(AA, F->getParent()->getDataLayout(), DstPtr, SrcPtr) == MustAlias); |