Skip to content

Commit

Permalink
[AArch64][SVE] Don't crash on pre-legalizer types in extload combine.
Browse files Browse the repository at this point in the history
This was assuming the vector types were MVTs, but they don't have to be.

Note that the concrete output of the test isn't very useful, since it's
dominated by nonsensical calling convention lowering for the weird types.

Differential Revision: https://reviews.llvm.org/D126505
  • Loading branch information
ahmedbougacha committed Jun 9, 2022
1 parent 1be3669 commit c68b469
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
Expand Up @@ -5310,7 +5310,7 @@ bool AArch64TargetLowering::mergeStoresAfterLegalization(EVT VT) const {

bool AArch64TargetLowering::useSVEForFixedLengthVectorVT(
EVT VT, bool OverrideNEON) const {
if (!VT.isFixedLengthVector())
if (!VT.isFixedLengthVector() || !VT.isSimple())
return false;

// Don't use SVE for vectors we cannot scalarize if required.
Expand Down
9 changes: 9 additions & 0 deletions llvm/test/CodeGen/AArch64/sve-fixed-length-ext-loads.ll
Expand Up @@ -30,6 +30,15 @@ define <4 x i32> @load_zext_v4i16i32(<4 x i16>* %ap) #0 {
ret <4 x i32> %val
}

; Don't try to use SVE for irregular types.
define <2 x i256> @load_zext_v2i64i256(<2 x i64>* %ap) #0 {
; CHECK-LABEL: load_zext_v2i64i256
; CHECK-NOT: ptrue
%a = load <2 x i64>, <2 x i64>* %ap
%val = zext <2 x i64> %a to <2 x i256>
ret <2 x i256> %val
}

define <8 x i32> @load_zext_v8i16i32(<8 x i16>* %ap) #0 {
; CHECK-LABEL: load_zext_v8i16i32
; CHECK: ptrue [[P0:p[0-9]+]].s, vl8
Expand Down

0 comments on commit c68b469

Please sign in to comment.