Page MenuHomePhabricator

[SLPVectorizer][SVE] Bail out early for scalable vector.

Authored by huihuiz on Mar 11 2020, 11:27 AM.



SLPVectorizer try to vectorize list of scalar instructions of the same type,
instructions already vectorized are rejected through isValidElementType().

Without this patch, tryToVectorizeList() will first try to determine vectorization
factor of a list of Instructions before checking whether each instruction has unsupported
type or not. For instructions already vectorized for SVE, it will crash at getVectorElementSize(),
where it try to return a fixed size.

This patch make sure invalid element types are rejected before trying to get vectorization
factor. This make sure we are not trying to vectorize instructions already vectorized.

Diff Detail

Event Timeline

huihuiz created this revision.Mar 11 2020, 11:27 AM

take test test/Transforms/SLPVectorizer/AArch64/scalable-vector.ll, run opt -slp-vectorizer

you will see it crash at: llvm-top/llvm/include/llvm/Support/TypeSize.h:126: uint64_t llvm::TypeSize::getFixedSize() const: Assertion `!IsScalable && "Request for a fixed size on a scalable object"' failed.

efriedma added inline comments.Mar 11 2020, 1:01 PM

Should we be using isValidElementType(V->getType()) here, instead of explicitly checking for vector types?

huihuiz updated this revision to Diff 250077.Mar 12 2020, 3:39 PM
huihuiz marked an inline comment as done.
huihuiz added inline comments.

Update patch by changing the checking sequence, reject invalid element type before trying to determine SLP vectorization factor.

If we move isValidElementType() into getSameOpcode(), we will lose the optimization remark missed information.

huihuiz edited the summary of this revision. (Show Details)Mar 12 2020, 3:43 PM
This revision is now accepted and ready to land.Mar 12 2020, 4:08 PM
This revision was automatically updated to reflect the committed changes.