• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt %s -scalarizer -S -o - | FileCheck %s
2; RUN: opt %s -passes='function(scalarizer)' -S -o - | FileCheck %s
3
4; Don't crash
5
6define void @foo() {
7  br label %bb1
8
9bb2:                                        ; preds = %bb1
10  %bb2_vec = shufflevector <2 x i16> <i16 0, i16 10000>,
11                           <2 x i16> %bb1_vec,
12                           <2 x i32> <i32 0, i32 3>
13  br label %bb1
14
15bb1:                                        ; preds = %bb2, %0
16  %bb1_vec = phi <2 x i16> [ <i16 100, i16 200>, %0 ], [ %bb2_vec, %bb2 ]
17;CHECK: bb1:
18;CHECK: %bb2_vec.i1 = phi i16 [ 200, %0 ], [ %bb2_vec.i1, %bb2 ]
19  br i1 undef, label %bb3, label %bb2
20
21bb3:
22  ret void
23}
24
25; See https://reviews.llvm.org/D83101#2135945
26define void @f1_crash(<2 x i16> %base, i1 %c, <2 x i16>* %ptr) {
27; CHECK-LABEL: @f1_crash(
28; CHECK: vector.ph:
29; CHECK:   %base.i0 = extractelement <2 x i16> %base, i32 0
30; CHECK:   %base.i1 = extractelement <2 x i16> %base, i32 1
31; CHECK:   br label %vector.body115
32; CHECK: vector.body115:                                   ; preds = %vector.body115, %vector.ph
33; CHECK:   %vector.recur.i0 = phi i16 [ %base.i0, %vector.ph ], [ %wide.load125.i0, %vector.body115 ]
34; CHECK:   %vector.recur.i1 = phi i16 [ %base.i1, %vector.ph ], [ %wide.load125.i1, %vector.body115 ]
35; CHECK:   %wide.load125 = load <2 x i16>, <2 x i16>* %ptr, align 1
36; CHECK:   %wide.load125.i0 = extractelement <2 x i16> %wide.load125, i32 0
37; CHECK:   %wide.load125.i1 = extractelement <2 x i16> %wide.load125, i32 1
38; CHECK:   br i1 %c, label %middle.block113, label %vector.body115
39; CHECK: middle.block113:                                  ; preds = %vector.body115
40; CHECK:   ret void
41; CHECK: }
42
43vector.ph:
44  br label %vector.body115
45
46vector.body115:
47  %vector.recur = phi <2 x i16> [ %base, %vector.ph ], [ %wide.load125, %vector.body115 ]
48  %wide.load125 = load <2 x i16>, <2 x i16>* %ptr, align 1
49  br i1 %c, label %middle.block113, label %vector.body115
50
51middle.block113:
52  ret void
53}
54