blob: 47d33352763dbfd8206bd08c9e7a42e0c1366afd [file] [log] [blame]
James Molloya860a222015-09-02 10:15:05 +00001; RUN: opt < %s -loop-vectorize -force-vector-width=4 -S | FileCheck %s
2
3target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
4
5; This testcase causes SCEV to return a pointer-typed exit value.
6
7; CHECK: @f
8; Expect that the pointer indvar has been converted into an integer indvar.
9; CHECK: %index.next = add i64 %index, 4
10define i32 @f(i32* readonly %a, i32* readnone %b) #0 {
11entry:
12 %cmp.6 = icmp ult i32* %a, %b
13 br i1 %cmp.6, label %while.body.preheader, label %while.end
14
15while.body.preheader: ; preds = %entry
16 br label %while.body
17
18while.body: ; preds = %while.body.preheader, %while.body
19 %a.pn = phi i32* [ %incdec.ptr8, %while.body ], [ %a, %while.body.preheader ]
20 %acc.07 = phi i32 [ %add, %while.body ], [ 0, %while.body.preheader ]
21 %incdec.ptr8 = getelementptr inbounds i32, i32* %a.pn, i64 1
22 %0 = load i32, i32* %incdec.ptr8, align 1
23 %add = add nuw nsw i32 %0, %acc.07
24 %exitcond = icmp eq i32* %incdec.ptr8, %b
25 br i1 %exitcond, label %while.cond.while.end_crit_edge, label %while.body
26
27while.cond.while.end_crit_edge: ; preds = %while.body
28 %add.lcssa = phi i32 [ %add, %while.body ]
29 br label %while.end
30
31while.end: ; preds = %while.cond.while.end_crit_edge, %entry
32 %acc.0.lcssa = phi i32 [ %add.lcssa, %while.cond.while.end_crit_edge ], [ 0, %entry ]
33 ret i32 %acc.0.lcssa
Chad Rosierb684e382015-09-02 14:06:16 +000034}