This is an archive of the discontinued LLVM Phabricator instance.

[DAGCombine][RISCV] Don't try to trunc-store combined vector stores
ClosedPublic

Authored by frasercrmck on May 26 2021, 8:44 AM.

Details

Summary

DAGCombine's mergeStoresOfConstantsOrVecElts optimization is told
whether it's to use vector types and also whether it's to issue a
truncating store. However, the truncating store code path assumes a
scalar integer ConstantSDNode, and when using vector types it creates
either a BUILD_VECTOR or CONCAT_VECTORS to store: neither of which
is a constant.

The riscv64 target is able to expose a crash here because it switches
on both code paths at the same time. The f32 is stored as i32 which
must be promoted to i64, necessitating a truncating store.
It also decides later that it prefers a vector store of v2f32.

While vector truncating stores are legal, this combine is not able to
emit them. We also don't have a test case. This patch adds an assert to
catch this case more gracefully, and updates one of the caller functions
to the function to turn off the use of truncating stores when preferring
vectors.

Diff Detail

Event Timeline

frasercrmck created this revision.May 26 2021, 8:44 AM
frasercrmck requested review of this revision.May 26 2021, 8:44 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 26 2021, 8:44 AM
This revision is now accepted and ready to land.May 26 2021, 9:30 AM
This revision was landed with ongoing or failed builds.May 27 2021, 6:24 AM
This revision was automatically updated to reflect the committed changes.