blob: 41968ac0518646d07b750e8d8b2421e036fbae6d [file] [log] [blame]
Sanjoy Dasac5bf592016-08-03 20:53:23 +00001; RUN: opt < %s -indvars -S | FileCheck %s
Dan Gohman8078b8b2009-02-18 17:22:41 +00002
Mehdi Amini46a43552015-03-04 18:43:29 +00003; Provide legal integer types.
4target datalayout = "n8:16:32:64"
5
6
Dan Gohman8078b8b2009-02-18 17:22:41 +00007define void @foo(i64* nocapture %x, i32 %n) nounwind {
Sanjoy Dasac5bf592016-08-03 20:53:23 +00008; CHECK-LABEL: @foo(
9; CHECK-NOT: sext
10; CHECK: phi
11; CHECK-NOT: phi
Dan Gohman8078b8b2009-02-18 17:22:41 +000012entry:
13 %tmp102 = icmp sgt i32 %n, 0 ; <i1> [#uses=1]
14 br i1 %tmp102, label %bb.nph, label %return
15
16bb.nph: ; preds = %entry
17 br label %bb
18
19bb: ; preds = %bb7, %bb.nph
20 %i.01 = phi i32 [ %tmp6, %bb7 ], [ 0, %bb.nph ] ; <i32> [#uses=3]
21 %tmp1 = sext i32 %i.01 to i64 ; <i64> [#uses=1]
David Blaikie79e6c742015-02-27 19:29:02 +000022 %tmp4 = getelementptr i64, i64* %x, i32 %i.01 ; <i64*> [#uses=1]
Dan Gohman8078b8b2009-02-18 17:22:41 +000023 store i64 %tmp1, i64* %tmp4, align 8
24 %tmp6 = add i32 %i.01, 1 ; <i32> [#uses=2]
25 br label %bb7
26
27bb7: ; preds = %bb
28 %tmp10 = icmp slt i32 %tmp6, %n ; <i1> [#uses=1]
29 br i1 %tmp10, label %bb, label %bb7.return_crit_edge
30
31bb7.return_crit_edge: ; preds = %bb7
32 br label %return
33
34return: ; preds = %bb7.return_crit_edge, %entry
35 ret void
36}