1; RUN: opt -S -loop-vectorize -dce -instcombine -force-vector-width=2 -force-vector-interleave=2 < %s | FileCheck %s 2 3target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" 4 5;PR 15830. 6 7;CHECK-LABEL: @foo( 8; When scalarizing stores we need to preserve the original order. 9; Make sure that we are extracting in the correct order (0101, and not 0011). 10;CHECK: extractelement <2 x i64> {{.*}}, i32 0 11;CHECK: extractelement <2 x i64> {{.*}}, i32 1 12;CHECK: extractelement <2 x i64> {{.*}}, i32 0 13;CHECK: extractelement <2 x i64> {{.*}}, i32 1 14;CHECK: store 15;CHECK: store 16;CHECK: store 17;CHECK: store 18;CHECK: ret 19 20define i32 @foo(i32* nocapture %A) { 21entry: 22 br label %for.body 23 24for.body: 25 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] 26 %0 = shl nsw i64 %indvars.iv, 2 27 %arrayidx = getelementptr inbounds i32, i32* %A, i64 %0 28 store i32 4, i32* %arrayidx, align 4 29 %indvars.iv.next = add i64 %indvars.iv, 1 30 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 31 %exitcond = icmp eq i32 %lftr.wideiv, 10000 32 br i1 %exitcond, label %for.end, label %for.body 33 34for.end: 35 ret i32 undef 36} 37 38 39