summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/LoopAccessAnalysis.cpp
diff options
context:
space:
mode:
authorMichael Kuperstein <mkuper@google.com>2017-02-03 19:32:50 +0000
committerMichael Kuperstein <mkuper@google.com>2017-02-03 19:32:50 +0000
commit2a735b71b6a5f98086e2843b8e3b7ef328bb51cc (patch)
tree637391f280da39cfbdbb09cf7658f72733d1d640 /llvm/lib/Analysis/LoopAccessAnalysis.cpp
parent9677cc6fb74918b9f9fffecb226c3747676de868 (diff)
downloadbcm5719-llvm-2a735b71b6a5f98086e2843b8e3b7ef328bb51cc.tar.gz
bcm5719-llvm-2a735b71b6a5f98086e2843b8e3b7ef328bb51cc.zip
[SLP] Make sortMemAccesses explicitly return an error. NFC.
llvm-svn: 294029
Diffstat (limited to 'llvm/lib/Analysis/LoopAccessAnalysis.cpp')
-rw-r--r--llvm/lib/Analysis/LoopAccessAnalysis.cpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
index 4e076f5f004..f035ccda6f5 100644
--- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp
+++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
@@ -1058,9 +1058,9 @@ static unsigned getAddressSpaceOperand(Value *I) {
return -1;
}
-void llvm::sortMemAccesses(ArrayRef<Value *> VL, const DataLayout &DL,
- ScalarEvolution &SE,
- SmallVectorImpl<Value *> &Sorted) {
+bool llvm::sortMemAccesses(ArrayRef<Value *> VL, const DataLayout &DL,
+ ScalarEvolution &SE,
+ SmallVectorImpl<Value *> &Sorted) {
SmallVector<std::pair<int64_t, Value *>, 4> OffValPairs;
OffValPairs.reserve(VL.size());
Sorted.reserve(VL.size());
@@ -1077,10 +1077,8 @@ void llvm::sortMemAccesses(ArrayRef<Value *> VL, const DataLayout &DL,
// If a pointer refers to a different underlying object, bail - the
// pointers are by definition incomparable.
Value *CurrObj = GetUnderlyingObject(Ptr, DL);
- if (CurrObj != Obj0) {
- Sorted.append(VL.begin(), VL.end());
- return;
- }
+ if (CurrObj != Obj0)
+ return false;
const SCEVConstant *Diff =
dyn_cast<SCEVConstant>(SE.getMinusSCEV(SE.getSCEV(Ptr), Scev0));
@@ -1088,10 +1086,8 @@ void llvm::sortMemAccesses(ArrayRef<Value *> VL, const DataLayout &DL,
// The pointers may not have a constant offset from each other, or SCEV
// may just not be smart enough to figure out they do. Regardless,
// there's nothing we can do.
- if (!Diff) {
- Sorted.append(VL.begin(), VL.end());
- return;
- }
+ if (!Diff)
+ return false;
OffValPairs.emplace_back(Diff->getAPInt().getSExtValue(), Val);
}
@@ -1102,8 +1098,10 @@ void llvm::sortMemAccesses(ArrayRef<Value *> VL, const DataLayout &DL,
return Left.first < Right.first;
});
- for (auto& it : OffValPairs)
+ for (auto &it : OffValPairs)
Sorted.push_back(it.second);
+
+ return true;
}
/// Returns true if the memory operations \p A and \p B are consecutive.
OpenPOWER on IntegriCloud