1*2e14900dSBjorn Pettersson; RUN: opt < %s -passes=loop-vectorize -force-vector-width=4 -S | FileCheck %s
2cee313d2SEric Christopher
3cee313d2SEric Christophertarget datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
4cee313d2SEric Christopher
5cee313d2SEric Christopher; This testcase causes SCEV to return a pointer-typed exit value.
6cee313d2SEric Christopher
7cee313d2SEric Christopher; CHECK: @f
8cee313d2SEric Christopher; Expect that the pointer indvar has been converted into an integer indvar.
923c2f2e6SFlorian Hahn; CHECK: %index.next = add nuw i64 %index, 4
10cee313d2SEric Christopherdefine i32 @f(i32* readonly %a, i32* readnone %b) #0 {
11cee313d2SEric Christopherentry:
12cee313d2SEric Christopher  %cmp.6 = icmp ult i32* %a, %b
13cee313d2SEric Christopher  br i1 %cmp.6, label %while.body.preheader, label %while.end
14cee313d2SEric Christopher
15cee313d2SEric Christopherwhile.body.preheader:                             ; preds = %entry
16cee313d2SEric Christopher  br label %while.body
17cee313d2SEric Christopher
18cee313d2SEric Christopherwhile.body:                                       ; preds = %while.body.preheader, %while.body
19cee313d2SEric Christopher  %a.pn = phi i32* [ %incdec.ptr8, %while.body ], [ %a, %while.body.preheader ]
20cee313d2SEric Christopher  %acc.07 = phi i32 [ %add, %while.body ], [ 0, %while.body.preheader ]
21cee313d2SEric Christopher  %incdec.ptr8 = getelementptr inbounds i32, i32* %a.pn, i64 1
22cee313d2SEric Christopher  %0 = load i32, i32* %incdec.ptr8, align 1
23cee313d2SEric Christopher  %add = add nuw nsw i32 %0, %acc.07
24cee313d2SEric Christopher  %exitcond = icmp eq i32* %incdec.ptr8, %b
25cee313d2SEric Christopher  br i1 %exitcond, label %while.cond.while.end_crit_edge, label %while.body
26cee313d2SEric Christopher
27cee313d2SEric Christopherwhile.cond.while.end_crit_edge:                   ; preds = %while.body
28cee313d2SEric Christopher  %add.lcssa = phi i32 [ %add, %while.body ]
29cee313d2SEric Christopher  br label %while.end
30cee313d2SEric Christopher
31cee313d2SEric Christopherwhile.end:                                        ; preds = %while.cond.while.end_crit_edge, %entry
32cee313d2SEric Christopher  %acc.0.lcssa = phi i32 [ %add.lcssa, %while.cond.while.end_crit_edge ], [ 0, %entry ]
33cee313d2SEric Christopher  ret i32 %acc.0.lcssa
34cee313d2SEric Christopher}
35