aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/LoopAccessAnalysis.cpp
diff options
context:
space:
mode:
authorMichael Kuperstein <mkuper@google.com>2017-02-27 23:18:11 +0000
committerMichael Kuperstein <mkuper@google.com>2017-02-27 23:18:11 +0000
commitc07cca85fbb88b3c3116b23f8f6ac741289906cb (patch)
treec6cb49075e15034b4066d38cecdde61c441fe149 /llvm/lib/Analysis/LoopAccessAnalysis.cpp
parent1588b6a9f8d51eed1df9776398f66040af39312c (diff)
downloadllvm-c07cca85fbb88b3c3116b23f8f6ac741289906cb.zip
llvm-c07cca85fbb88b3c3116b23f8f6ac741289906cb.tar.gz
llvm-c07cca85fbb88b3c3116b23f8f6ac741289906cb.tar.bz2
[SLP] Load sorting should not try to sort things that aren't loads.
We may get a VL where the first element is a load, but the others aren't. Trying to sort such VLs can only lead to sorrow. llvm-svn: 296411
Diffstat (limited to 'llvm/lib/Analysis/LoopAccessAnalysis.cpp')
-rw-r--r--llvm/lib/Analysis/LoopAccessAnalysis.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
index 0e4e37f..a3ed412 100644
--- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp
+++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
@@ -1052,7 +1052,12 @@ bool llvm::sortMemAccesses(ArrayRef<Value *> VL, const DataLayout &DL,
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.