1*cee313d2SEric Christopher; RUN: opt < %s -loop-vectorize -mtriple=x86_64-unknown-linux-gnu -S
2*cee313d2SEric Christopher
3*cee313d2SEric Christopher; Make sure we are not crashing on this one.
4*cee313d2SEric Christopher
5*cee313d2SEric Christophertarget 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"
6*cee313d2SEric Christophertarget triple = "x86_64-unknown-linux-gnu"
7*cee313d2SEric Christopher
8*cee313d2SEric Christopher@glbl = external global [16 x { i64, i64 }], align 16
9*cee313d2SEric Christopher
10*cee313d2SEric Christopherdeclare void @fn()
11*cee313d2SEric Christopher
12*cee313d2SEric Christopherdefine void @test() {
13*cee313d2SEric Christopherentry:
14*cee313d2SEric Christopher  br label %loop
15*cee313d2SEric Christopher
16*cee313d2SEric Christopherloop:
17*cee313d2SEric Christopher  %indvars.iv = phi i64 [ %indvars.iv.next, %loop ], [ 0, %entry ]
18*cee313d2SEric Christopher  %tmp = getelementptr inbounds [16 x { i64, i64 }], [16 x { i64, i64 }]* @glbl, i64 0, i64 %indvars.iv
19*cee313d2SEric Christopher  store { i64, i64 } { i64 ptrtoint (void ()* @fn to i64), i64 0 }, { i64, i64 }* %tmp, align 16
20*cee313d2SEric Christopher  %indvars.iv.next = add i64 %indvars.iv, 1
21*cee313d2SEric Christopher  %lftr.wideiv = trunc i64 %indvars.iv.next to i32
22*cee313d2SEric Christopher  %exitcond = icmp ne i32 %lftr.wideiv, 16
23*cee313d2SEric Christopher  br i1 %exitcond, label %loop, label %exit
24*cee313d2SEric Christopher
25*cee313d2SEric Christopherexit:
26*cee313d2SEric Christopher  ret void
27*cee313d2SEric Christopher}
28