diff options
| author | Bjorn Pettersson <bjorn.a.pettersson@ericsson.com> | 2019-06-17 12:02:24 +0000 | 
|---|---|---|
| committer | Bjorn Pettersson <bjorn.a.pettersson@ericsson.com> | 2019-06-17 12:02:24 +0000 | 
| commit | 83773b77a5a45592426a2e8011a36dc1fa19aedc (patch) | |
| tree | 7d8abf776d4ec7e377902e230c6b0b31837c1bf6 /llvm/lib/Transforms/Vectorize | |
| parent | 74ac20158a068633e0a84f9f95e7242ceab6b61d (diff) | |
| download | bcm5719-llvm-83773b77a5a45592426a2e8011a36dc1fa19aedc.tar.gz bcm5719-llvm-83773b77a5a45592426a2e8011a36dc1fa19aedc.zip | |
[LV] Deny irregular types in interleavedAccessCanBeWidened
Summary:
Avoid that loop vectorizer creates loads/stores of vectors
with "irregular" types when interleaving. An example of
an irregular type is x86_fp80 that is 80 bits, but that
may have an allocation size that is 96 bits. So an array
of x86_fp80 is not bitcast compatible with a vector
of the same type.
Not sure if interleavedAccessCanBeWidened is the best
place for this check, but it solves the problem seen
in the added test case. And it is the same kind of check
that already exists in memoryInstructionCanBeWidened.
Reviewers: fhahn, Ayal, craig.topper
Reviewed By: fhahn
Subscribers: hiraditya, rkruppe, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D63386
llvm-svn: 363547
Diffstat (limited to 'llvm/lib/Transforms/Vectorize')
| -rw-r--r-- | llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | 7 | 
1 files changed, 7 insertions, 0 deletions
| diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp index 79528e5927e..d0d72d8de90 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -4412,6 +4412,13 @@ bool LoopVectorizationCostModel::interleavedAccessCanBeWidened(Instruction *I,    auto *Group = getInterleavedAccessGroup(I);    assert(Group && "Must have a group."); +  // If the instruction's allocated size doesn't equal it's type size, it +  // requires padding and will be scalarized. +  auto &DL = I->getModule()->getDataLayout(); +  auto *ScalarTy = getMemInstValueType(I); +  if (hasIrregularType(ScalarTy, DL, VF)) +    return false; +    // Check if masking is required.    // A Group may need masking for one of two reasons: it resides in a block that    // needs predication, or it was decided to use masking to deal with gaps. | 

