Page MenuHomePhabricator

[SelectionDAG] Allow FindMemType to fail when widening loads & stores
ClosedPublic

Authored by frasercrmck on Oct 18 2021, 8:22 AM.

Details

Summary

This patch removes an internal failure found in FindMemType and "bubbles
it up" to the users of that method: GenWidenVectorLoads and
GenWidenVectorStores. FindMemType -- renamed findMemType -- now returns
an optional value, returning None if no such type is found.

Each of the aforementioned users now pre-calculates the list of types it
will use to widen the memory access. If the type breakdown is not
possible they will signal a failure, at which point the compiler will
crash as it does currently.

This patch is preparing the ground for alternative legalization
strategies for vector loads and stores, such as using vector-predication
versions of loads or stores.

Diff Detail

Event Timeline

frasercrmck created this revision.Oct 18 2021, 8:22 AM
frasercrmck requested review of this revision.Oct 18 2021, 8:22 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 18 2021, 8:22 AM
RKSimon added inline comments.Oct 18 2021, 8:57 AM
llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
5038–5039

(style)

if (!GenWidenVectorStores(StChain, ST))
  llvm_unreachable("Unable to widen vector store");
5433

(style) It'd be better if you didn't use auto

5656–5671

(style) It'd be better if you didn't use auto

frasercrmck marked 3 inline comments as done.
  • address review feedback
frasercrmck added inline comments.Oct 18 2021, 9:03 AM
llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
5038–5039

Yeah fair enough. Given I'm building on top of it I thought I'd minimize the diff ahead of time, but I agree this is better as a standalone change.

5433

Makes sense; it can be difficult to transition between different styles of auto usage...

  • use report_fatal_error over llvm_unreachable

LGTM - does anyone have any other comments?

  • ping (& rebase)
RKSimon accepted this revision.Fri, Oct 29, 9:34 AM

LGTM

This revision is now accepted and ready to land.Fri, Oct 29, 9:34 AM