[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
This commit is contained in:
Michael Kuperstein
2017-02-27 23:18:11 +00:00
parent 1588b6a9f8
commit c07cca85fb
2 changed files with 48 additions and 0 deletions

View File

@@ -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.