diff options
author | Michael Kuperstein <mkuper@google.com> | 2017-03-10 18:59:07 +0000 |
---|---|---|
committer | Michael Kuperstein <mkuper@google.com> | 2017-03-10 18:59:07 +0000 |
commit | 5fb39a79665b2380b2ac01f5f581ab571a897345 (patch) | |
tree | 1fdddb0ba62adcf796d36766721c0ee9a339c81b /llvm/lib/Analysis/LoopAccessAnalysis.cpp | |
parent | 7dedbfa89d7380555f77abc624061de40ae91e5f (diff) | |
download | bcm5719-llvm-5fb39a79665b2380b2ac01f5f581ab571a897345.tar.gz bcm5719-llvm-5fb39a79665b2380b2ac01f5f581ab571a897345.zip |
[SLP] Revert everything that has to do with memory access sorting.
This reverts r293386, r294027, r294029 and r296411.
Turns out the SLP tree isn't actually a "tree" and we don't handle
accessing the same packet of loads in several different orders well,
causing miscompiles.
Revert until we can fix this properly.
llvm-svn: 297493
Diffstat (limited to 'llvm/lib/Analysis/LoopAccessAnalysis.cpp')
-rw-r--r-- | llvm/lib/Analysis/LoopAccessAnalysis.cpp | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp index c294527d5b0..72488f1f080 100644 --- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp +++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp @@ -1038,57 +1038,6 @@ static unsigned getAddressSpaceOperand(Value *I) { return -1; } -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()); - - // Walk over the pointers, and map each of them to an offset relative to - // first pointer in the array. - Value *Ptr0 = getPointerOperand(VL[0]); - const SCEV *Scev0 = SE.getSCEV(Ptr0); - Value *Obj0 = GetUnderlyingObject(Ptr0, DL); - - for (auto *Val : VL) { - // The only kind of access we care about here is load. - if (!isa<LoadInst>(Val)) - return false; - - Value *Ptr = getPointerOperand(Val); - assert(Ptr && "Expected value to have a pointer operand."); - - // If a pointer refers to a different underlying object, bail - the - // pointers are by definition incomparable. - Value *CurrObj = GetUnderlyingObject(Ptr, DL); - if (CurrObj != Obj0) - return false; - - const SCEVConstant *Diff = - dyn_cast<SCEVConstant>(SE.getMinusSCEV(SE.getSCEV(Ptr), Scev0)); - - // 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) - return false; - - OffValPairs.emplace_back(Diff->getAPInt().getSExtValue(), Val); - } - - std::sort(OffValPairs.begin(), OffValPairs.end(), - [](const std::pair<int64_t, Value *> &Left, - const std::pair<int64_t, Value *> &Right) { - return Left.first < Right.first; - }); - - for (auto &it : OffValPairs) - Sorted.push_back(it.second); - - return true; -} - /// Returns true if the memory operations \p A and \p B are consecutive. bool llvm::isConsecutiveAccess(Value *A, Value *B, const DataLayout &DL, ScalarEvolution &SE, bool CheckType) { |