Skip to content

Commit bfd8cc0

Browse files
committed
[SLP]Fix a check for the whole register use
Need to check the value type, not the return type, of the instructions, when doing the analysis for the whole register use to prevent a compiler crash. Fixes #133751
1 parent 2d7add6 commit bfd8cc0

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8854,7 +8854,8 @@ void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth,
88548854
// FIXME: Reshuffing scalars is not supported yet for non-power-of-2 ops.
88558855
if ((UserTreeIdx.UserTE &&
88568856
UserTreeIdx.UserTE->hasNonWholeRegisterOrNonPowerOf2Vec(*TTI)) ||
8857-
!hasFullVectorsOrPowerOf2(*TTI, VL.front()->getType(), VL.size())) {
8857+
!hasFullVectorsOrPowerOf2(*TTI, getValueType(VL.front()),
8858+
VL.size())) {
88588859
LLVM_DEBUG(dbgs() << "SLP: Reshuffling scalars not yet supported "
88598860
"for nodes with padding.\n");
88608861
auto Invalid = ScheduleBundle::invalid();
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
2+
; RUN: opt -S --passes=slp-vectorizer -mtriple=x86_64-grtev4-linux-gnu < %s | FileCheck %s
3+
4+
define void @test() {
5+
; CHECK-LABEL: define void @test() {
6+
; CHECK-NEXT: [[ENTRY:.*]]:
7+
; CHECK-NEXT: br i1 false, label %[[BB1:.*]], label %[[BB2:.*]]
8+
; CHECK: [[BB2]]:
9+
; CHECK-NEXT: [[CMP14_US:%.*]] = fcmp ogt x86_fp80 0xK00000000000000000000, 0xK00000000000000000000
10+
; CHECK-NEXT: [[IMAX_2_US:%.*]] = select i1 [[CMP14_US]], i64 0, i64 0
11+
; CHECK-NEXT: [[JMAX_2_US:%.*]] = select i1 [[CMP14_US]], i64 0, i64 0
12+
; CHECK-NEXT: [[CMP13_US:%.*]] = fcmp olt x86_fp80 0xK00000000000000000000, 0xK00000000000000000000
13+
; CHECK-NEXT: [[IMIN_2_US:%.*]] = select i1 [[CMP13_US]], i64 0, i64 0
14+
; CHECK-NEXT: [[JMIN_2_US:%.*]] = select i1 [[CMP13_US]], i64 0, i64 0
15+
; CHECK-NEXT: br label %[[BB1]]
16+
; CHECK: [[BB1]]:
17+
; CHECK-NEXT: [[STOREMERGE64:%.*]] = phi i64 [ 0, %[[ENTRY]] ], [ [[IMIN_2_US]], %[[BB2]] ]
18+
; CHECK-NEXT: [[STOREMERGE63:%.*]] = phi i64 [ 0, %[[ENTRY]] ], [ [[JMIN_2_US]], %[[BB2]] ]
19+
; CHECK-NEXT: [[STOREMERGE62:%.*]] = phi i64 [ 0, %[[ENTRY]] ], [ [[IMAX_2_US]], %[[BB2]] ]
20+
; CHECK-NEXT: [[STOREMERGE:%.*]] = phi i64 [ 0, %[[ENTRY]] ], [ [[JMAX_2_US]], %[[BB2]] ]
21+
; CHECK-NEXT: ret void
22+
;
23+
entry:
24+
br i1 false, label %bb1, label %bb2
25+
26+
bb2:
27+
%cmp14.us = fcmp ogt x86_fp80 0xK00000000000000000000, 0xK00000000000000000000
28+
%imax.2.us = select i1 %cmp14.us, i64 0, i64 0
29+
%jmax.2.us = select i1 %cmp14.us, i64 0, i64 0
30+
%cmp13.us = fcmp olt x86_fp80 0xK00000000000000000000, 0xK00000000000000000000
31+
%imin.2.us = select i1 %cmp13.us, i64 0, i64 0
32+
%jmin.2.us = select i1 %cmp13.us, i64 0, i64 0
33+
br label %bb1
34+
35+
bb1:
36+
%storemerge64 = phi i64 [ 0, %entry ], [ %imin.2.us, %bb2 ]
37+
%storemerge63 = phi i64 [ 0, %entry ], [ %jmin.2.us, %bb2 ]
38+
%storemerge62 = phi i64 [ 0, %entry ], [ %imax.2.us, %bb2 ]
39+
%storemerge = phi i64 [ 0, %entry ], [ %jmax.2.us, %bb2 ]
40+
ret void
41+
}

0 commit comments

Comments
 (0)