[PATCH] D102073: [TargetLowering] Legalize "vscale x 1" types in more cases
Sander de Smalen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 12 02:59:36 PDT 2021
sdesmalen added a comment.
Hi @frasercrmck, thanks for working on this. We're currently investigating legalization of <vscale x 1 x eltty> vectors for SVE, so we'll be able to add some tests for the widening case.
================
Comment at: llvm/lib/CodeGen/TargetLoweringBase.cpp:997
+ if (LK.first == TypeExpandInteger) {
+ if (VT.getVectorElementCount() == ElementCount::getScalable(1))
+ report_fatal_error("Cannot legalize this scalable vector");
----------------
I found that when widening <vscale x 1 x eltty>, it shouldn't go down this code-path and hit the fatal error, but rather continue down the code path below (so that it will actually try to widening to <vscale x 2 x eltty>, <vscale x 4 x eltty>, etc. until it has found a legal one.
That said, without a way to test this having the fatal_error is fine for now, especially since we'll soon share some patches that implements the widening of these types with corresponding tests. vscale x 1 types are never legal for SVE and always need widening.
================
Comment at: llvm/lib/CodeGen/TargetLoweringBase.cpp:1515
LegalizeTypeAction TA = getTypeAction(Context, VT);
- if (EltCnt.getKnownMinValue() != 1 &&
+ if ((EltCnt.isScalable() || EltCnt.getFixedValue() != 1) &&
(TA == TypeWidenVector || TA == TypePromoteInteger)) {
----------------
Is this equivalent to `EltCnt.isVector()` ? (I assume we can assert that a minimum value of 0 is not allowed)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D102073/new/
https://reviews.llvm.org/D102073
More information about the llvm-commits
mailing list