[SVE] Fix invalid uses of VectorType::getNumElements() in ValueTracking
authorChristopher Tetreault <ctetreau@quicinc.com>
Wed, 6 May 2020 16:53:57 +0000 (09:53 -0700)
committerChristopher Tetreault <ctetreau@quicinc.com>
Wed, 6 May 2020 17:06:06 +0000 (10:06 -0700)
commit782231ac799fd9c58d317c7ba168495510995df8
treefe499a2934ff507da837a5b243030ce72ef35361
parent6d6d48add8a8fcfbc311648a1d6b1ccc6e1e8b26
[SVE] Fix invalid uses of VectorType::getNumElements() in ValueTracking

Summary:
Any function in this module that make use of DemandedElts laregely does
not work with scalable vectors. DemandedElts is used to define which
elements of the vector to look at. At best, for scalable vectors, we can
express the first N elements of the vector. However, in practice, most
code that uses these functions expect to be able to talk about the
entire vector. In principle, this module should be able to be extended
to work with scalable vectors. However, before we can do that, we should
ensure that it does not cause code with scalable vectors to miscompile.
All functions that use a DemandedElts will bail out if the vector is
scalable. Usages of getNumElements() are updated to go through
FixedVectorType pointers.

Reviewers: rengolin, efriedma, sdesmalen, c-rhodes, spatel

Reviewed By: efriedma

Subscribers: david-arm, tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D79053
llvm/lib/Analysis/ValueTracking.cpp