1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=slp-vectorizer -slp-max-vf=2 -slp-min-reg-size=32 -S < %s | FileCheck %s
4 ; It is possible to compute the tree cost for an insertelement that does not
5 ; have a constant index when the index is a PHI. Check if getInsertIndex
8 define void @test() local_unnamed_addr {
11 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
12 ; CHECK: for.cond.cleanup:
13 ; CHECK-NEXT: unreachable
15 ; CHECK-NEXT: [[I:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ poison, [[FOR_BODY]] ]
16 ; CHECK-NEXT: [[J:%.*]] = phi i32 [ poison, [[ENTRY]] ], [ 0, [[FOR_BODY]] ]
17 ; CHECK-NEXT: [[TMP0:%.*]] = insertelement <4 x i32> poison, i32 poison, i32 [[I]]
18 ; CHECK-NEXT: br i1 poison, label [[FOR_COND_CLEANUP:%.*]], label [[FOR_BODY]]
27 %i = phi i32 [ 0, %entry ], [ poison, %for.body ]
28 %j = phi i32 [ poison, %entry ], [ 0, %for.body ]
29 %0 = insertelement <4 x i32> poison, i32 poison, i32 %i
30 br i1 poison, label %for.cond.cleanup, label %for.body