[llvm] [SLP][REVEC] Fix CommonMask is transformed into vector form but used outside finalize. (PR #120952)

Han-Kuan Chen via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 23 22:24:41 PST 2024


HanKuanChen wrote:

What do you mean "actual-sized"? Determined by `unsigned VecVF = cast<FixedVectorType>(Vec->getType())->getNumElements();`
If that is true, it will modify a lot of code. Especially we don't have test to make sure it is true.

A code like `unsigned VecVF = cast<FixedVectorType>(Vec->getType())->getNumElements();` should be divided by the number of elements of ScalarTy. Just like `getVF`. e.g.,
```
    unsigned ScalarTyNumElements = getNumElements(ScalarTy);
    unsigned VNumElements =
        cast<FixedVectorType>(V->getType())->getNumElements();
    assert(VNumElements > ScalarTyNumElements &&
           "the number of elements of V is not large enough");
    assert(VNumElements % ScalarTyNumElements == 0 &&
           "the number of elements of V is not a vectorized value");
    return VNumElements / ScalarTyNumElements;
```

https://github.com/llvm/llvm-project/pull/120952


More information about the llvm-commits mailing list