blob: 86e90c7623d14efeb0b4bcd01cf0fd1caa9bd1fb [file] [log] [blame]
Dan Gohmanc70c3772009-09-26 16:11:57 +00001; RUN: opt < %s -indvars -S > %t
2; RUN: not grep inttoptr %t
3; RUN: not grep ptrtoint %t
4; RUN: grep scevgep %t
5
6; Indvars shouldn't need inttoptr/ptrtoint to expand an address here.
7
8define void @foo(i8* %p) nounwind {
9entry:
10 br i1 true, label %bb.nph, label %for.end
11
12for.cond:
13 %phitmp = icmp slt i64 %inc, 20
14 br i1 %phitmp, label %for.body, label %for.cond.for.end_crit_edge
15
16for.cond.for.end_crit_edge:
17 br label %for.end
18
19bb.nph:
20 br label %for.body
21
22for.body:
23 %storemerge1 = phi i64 [ %inc, %for.cond ], [ 0, %bb.nph ]
24 %call = tail call i64 @bar() nounwind
25 %call2 = tail call i64 @car() nounwind
26 %conv = trunc i64 %call2 to i8
27 %conv3 = sext i8 %conv to i64
28 %add = add nsw i64 %call, %storemerge1
29 %add4 = add nsw i64 %add, %conv3
30 %arrayidx = getelementptr inbounds i8* %p, i64 %add4
31 store i8 0, i8* %arrayidx
32 %inc = add nsw i64 %storemerge1, 1
33 br label %for.cond
34
35for.end:
36 ret void
37}
38
39declare i64 @bar()
40
41declare i64 @car()