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 3 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 6; returns None. 7 8define void @test() local_unnamed_addr { 9; CHECK-LABEL: @test( 10; CHECK-NEXT: entry: 11; CHECK-NEXT: br label [[FOR_BODY:%.*]] 12; CHECK: for.cond.cleanup: 13; CHECK-NEXT: unreachable 14; CHECK: for.body: 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]] 19; 20entry: 21 br label %for.body 22 23for.cond.cleanup: 24 unreachable 25 26for.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 31} 32