You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
D113035 enhanced the matching of bitwise selects from vector types. This
change unfortunately introduced crashes as it tries to cast scalable
vector types to integers.
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D124997
(cherry picked from commit bafab9c)
Copy file name to clipboardExpand all lines: llvm/test/Transforms/InstCombine/logical-select.ll
+31Lines changed: 31 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -471,6 +471,18 @@ define <4 x i1> @vec_of_bools(<4 x i1> %a, <4 x i1> %b, <4 x i1> %c) {
471
471
ret <4 x i1> %or
472
472
}
473
473
474
+
define <vscale x 1 x i1> @vec_of_bools_scalable(<vscale x 1 x i1> %a, <vscale x 1 x i1> %c, <vscale x 1 x i1> %d) {
475
+
; CHECK-LABEL: @vec_of_bools_scalable(
476
+
; CHECK-NEXT: [[TMP1:%.*]] = select <vscale x 1 x i1> [[A:%.*]], <vscale x 1 x i1> [[C:%.*]], <vscale x 1 x i1> [[D:%.*]]
477
+
; CHECK-NEXT: ret <vscale x 1 x i1> [[TMP1]]
478
+
;
479
+
%b = xor <vscale x 1 x i1> %a, shufflevector (<vscale x 1 x i1> insertelement (<vscale x 1 x i1> poison, i1true, i320), <vscale x 1 x i1> poison, <vscale x 1 x i32> zeroinitializer)
480
+
%t11 = and <vscale x 1 x i1> %a, %c
481
+
%t12 = and <vscale x 1 x i1> %b, %d
482
+
%r = or <vscale x 1 x i1> %t11, %t12
483
+
ret <vscale x 1 x i1> %r
484
+
}
485
+
474
486
definei4@vec_of_casted_bools(i4%a, i4%b, <4 x i1> %c) {
475
487
; CHECK-LABEL: @vec_of_casted_bools(
476
488
; CHECK-NEXT: [[TMP1:%.*]] = bitcast i4 [[B:%.*]] to <4 x i1>
define <vscale x 1 x i64> @vec_of_casted_bools_scalable(<vscale x 1 x i64> %a, <vscale x 1 x i64> %b, <vscale x 8 x i1> %cond) {
504
+
; CHECK-LABEL: @vec_of_casted_bools_scalable(
505
+
; CHECK-NEXT: [[TMP1:%.*]] = bitcast <vscale x 1 x i64> [[A:%.*]] to <vscale x 8 x i8>
506
+
; CHECK-NEXT: [[TMP2:%.*]] = bitcast <vscale x 1 x i64> [[B:%.*]] to <vscale x 8 x i8>
507
+
; CHECK-NEXT: [[TMP3:%.*]] = select <vscale x 8 x i1> [[COND:%.*]], <vscale x 8 x i8> [[TMP1]], <vscale x 8 x i8> [[TMP2]]
508
+
; CHECK-NEXT: [[TMP4:%.*]] = bitcast <vscale x 8 x i8> [[TMP3]] to <vscale x 1 x i64>
509
+
; CHECK-NEXT: ret <vscale x 1 x i64> [[TMP4]]
510
+
;
511
+
%scond = sext <vscale x 8 x i1> %condto <vscale x 8 x i8>
512
+
%notcond = xor <vscale x 8 x i1> %cond, shufflevector (<vscale x 8 x i1> insertelement (<vscale x 8 x i1> poison, i1true, i320), <vscale x 8 x i1> poison, <vscale x 8 x i32> zeroinitializer)
513
+
%snotcond = sext <vscale x 8 x i1> %notcondto <vscale x 8 x i8>
514
+
%bc1 = bitcast <vscale x 8 x i8> %scondto <vscale x 1 x i64>
515
+
%bc2 = bitcast <vscale x 8 x i8> %snotcondto <vscale x 1 x i64>
516
+
%and1 = and <vscale x 1 x i64> %a, %bc1
517
+
%and2 = and <vscale x 1 x i64> %bc2, %b
518
+
%or = or <vscale x 1 x i64> %and1, %and2
519
+
ret <vscale x 1 x i64> %or
520
+
}
521
+
491
522
; Inverted 'and' constants mean this is a select which is canonicalized to a shuffle.
492
523
493
524
define <4 x i32> @vec_sel_consts(<4 x i32> %a, <4 x i32> %b) {
0 commit comments