Skip to content

Commit f65d5a7

Browse files
[DAG] Skip mstore combine for <1 x ty> vectors (#159915)
Fixes #159912
1 parent 8b52d62 commit f65d5a7

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22690,6 +22690,12 @@ static SDValue foldToMaskedStore(StoreSDNode *Store, SelectionDAG &DAG,
2269022690
SDValue StorePtr = Store->getBasePtr();
2269122691
SDValue StoreOffset = Store->getOffset();
2269222692
EVT VT = Store->getMemoryVT();
22693+
22694+
// Skip this combine for non-vector types and for <1 x ty> vectors, as they
22695+
// will be scalarized later.
22696+
if (!VT.isVector() || VT.isScalableVector() || VT.getVectorNumElements() == 1)
22697+
return SDValue();
22698+
2269322699
unsigned AddrSpace = Store->getAddressSpace();
2269422700
Align Alignment = Store->getAlign();
2269522701
const TargetLowering &TLI = DAG.getTargetLoweringInfo();

llvm/test/CodeGen/AArch64/combine-storetomstore.ll

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,3 +1135,19 @@ define void @test_masked_store_unaligned_v8i64(<8 x i64> %data, ptr %ptr, <8 x i
11351135
store <8 x i64> %sel, ptr %ptr_vec, align 1
11361136
ret void
11371137
}
1138+
1139+
define void @PR159912(<1 x i1> %arg, ptr %ptr) #0 {
1140+
; SVE-LABEL: PR159912:
1141+
; SVE: // %bb.0:
1142+
; SVE-NEXT: tst w0, #0x1
1143+
; SVE-NEXT: ldr d0, [x1]
1144+
; SVE-NEXT: csetm x8, ne
1145+
; SVE-NEXT: fmov d1, x8
1146+
; SVE-NEXT: bic v0.8b, v0.8b, v1.8b
1147+
; SVE-NEXT: str d0, [x1]
1148+
; SVE-NEXT: ret
1149+
%load = load <1 x i64>, ptr %ptr, align 8
1150+
%select = select <1 x i1> %arg, <1 x i64> zeroinitializer, <1 x i64> %load
1151+
store <1 x i64> %select, ptr %ptr, align 8
1152+
ret void
1153+
}

0 commit comments

Comments
 (0)