Skip to content

Commit 470f070

Browse files
committed
SDag: fix how initial loads are formed when splitting vector ops.
Later code expects the vector loads produced to be directly concatenable, which means we shouldn't pad anything except the last load produced with UNDEF. llvm-svn: 293088
1 parent 9e35f1e commit 470f070

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3442,7 +3442,10 @@ SDValue DAGTypeLegalizer::GenWidenVectorLoads(SmallVectorImpl<SDValue> &LdChain,
34423442
LD->getPointerInfo().getWithOffset(Offset),
34433443
MinAlign(Align, Increment), MMOFlags, AAInfo);
34443444
LdChain.push_back(L.getValue(1));
3445-
if (L->getValueType(0).isVector()) {
3445+
if (L->getValueType(0).isVector() && NewVTWidth >= LdWidth) {
3446+
// Later code assumes the vector loads produced will be mergeable, so we
3447+
// must pad the final entry up to the previous width. Scalars are
3448+
// combined separately.
34463449
SmallVector<SDValue, 16> Loads;
34473450
Loads.push_back(L);
34483451
unsigned size = L->getValueSizeInBits(0);

llvm/test/CodeGen/ARM/vector-load.ll

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,3 +251,13 @@ define <4 x i32> @zextload_v8i8tov8i32_fake_update(<4 x i8>** %ptr) {
251251
%zlA = zext <4 x i8> %lA to <4 x i32>
252252
ret <4 x i32> %zlA
253253
}
254+
255+
; CHECK-LABEL: test_silly_load:
256+
; CHECK: ldr {{r[0-9]+}}, [r0, #24]
257+
; CHECK: vld1.8 {d{{[0-9]+}}, d{{[0-9]+}}}, [r0:128]!
258+
; CHECK: vldr d{{[0-9]+}}, [r0]
259+
260+
define void @test_silly_load(<28 x i8>* %addr) {
261+
load volatile <28 x i8>, <28 x i8>* %addr
262+
ret void
263+
}

0 commit comments

Comments
 (0)