This is an archive of the discontinued LLVM Phabricator instance.

[SelectionDAG] Fix illegal widening of scalable-vector loads
ClosedPublic

Authored by frasercrmck on Oct 15 2021, 6:50 AM.

Details

Summary

The process of widening simple vector loads attempts to use a load of a
wider vector type if the original load is sufficiently aligned to avoid
memory faults.

However this optimization is only legal when performed on fixed-length
vector types. For scalable vector types this is invalid (unless vscale
happens to be 1).

This patch does increase the likelihood of compiler crashes (from
FindMemType failing to find a suitable type) but this now better
matches how widening non-simple loads, insufficiently-aligned loads, and
scalable-vector stores are handled.

Patches will be introduced later by which loads and stores can be
widened on targets with support for masked or predicated operations.

Diff Detail