Skip to content

Commit d9a7e51

Browse files
nikictstellar
authored andcommitted
[InterleavedLoadCombine] Bail out on non-byte-sized vector element type (#90705)
Vectors are always tightly packed, and elements of non-byte-sized usually do not have a well-defined (byte) offset. Fixes #90695. (cherry picked from commit d484c4d)
1 parent 0a045c9 commit d9a7e51

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

llvm/lib/CodeGen/InterleavedLoadCombinePass.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -877,6 +877,9 @@ struct VectorInfo {
877877
if (LI->isAtomic())
878878
return false;
879879

880+
if (!DL.typeSizeEqualsStoreSize(Result.VTy->getElementType()))
881+
return false;
882+
880883
// Get the base polynomial
881884
computePolynomialFromPointer(*LI->getPointerOperand(), Offset, BasePtr, DL);
882885

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
2+
; RUN: opt -S -passes=interleaved-load-combine < %s | FileCheck %s
3+
4+
target triple = "aarch64-unknown-windows-gnu"
5+
6+
; Make sure we don't crash on loads of vectors of non-byte-sized types.
7+
define <4 x i1> @test(ptr %p) {
8+
; CHECK-LABEL: define <4 x i1> @test(
9+
; CHECK-SAME: ptr [[P:%.*]]) {
10+
; CHECK-NEXT: entry:
11+
; CHECK-NEXT: [[LOAD:%.*]] = load <2 x i1>, ptr [[P]], align 1
12+
; CHECK-NEXT: [[SHUF:%.*]] = shufflevector <2 x i1> [[LOAD]], <2 x i1> zeroinitializer, <4 x i32> <i32 0, i32 1, i32 2, i32 2>
13+
; CHECK-NEXT: ret <4 x i1> [[SHUF]]
14+
;
15+
entry:
16+
%load = load <2 x i1>, ptr %p, align 1
17+
%shuf = shufflevector <2 x i1> %load, <2 x i1> zeroinitializer, <4 x i32> <i32 0, i32 1, i32 2, i32 2>
18+
ret <4 x i1> %shuf
19+
}

0 commit comments

Comments
 (0)