This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Prevent store combining from infinitely looping
ClosedPublic

Authored by frasercrmck on May 21 2021, 5:08 AM.

Details

Summary

RVV code generation does not successfully custom-lower BUILD_VECTOR in all
cases. When it resorts to default expansion it may, on occasion, be expanded to
scalar stores through the stack. Unfortunately these stores may then be picked
up by the post-legalization DAGCombiner which merges them again. The merged
store uses a BUILD_VECTOR which is then expanded, and so on.

This patch addresses the issue by overriding the mergeStoresAfterLegalization
hook. A lack of granularity in this method (being passed the scalar type) means
we opt out in almost all cases when RVV fixed-length vector support is enabled.
The only exception to this rule are mask vectors, which are always either
custom-lowered or are expanded to a load from a constant pool.

Diff Detail

Event Timeline

frasercrmck created this revision.May 21 2021, 5:08 AM
frasercrmck requested review of this revision.May 21 2021, 5:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 21 2021, 5:08 AM
This revision is now accepted and ready to land.May 22 2021, 8:23 AM