Dan Gohman | c70c377 | 2009-09-26 16:11:57 +0000 | [diff] [blame^] | 1 | ; 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 | |
| 8 | define void @foo(i8* %p) nounwind { |
| 9 | entry: |
| 10 | br i1 true, label %bb.nph, label %for.end |
| 11 | |
| 12 | for.cond: |
| 13 | %phitmp = icmp slt i64 %inc, 20 |
| 14 | br i1 %phitmp, label %for.body, label %for.cond.for.end_crit_edge |
| 15 | |
| 16 | for.cond.for.end_crit_edge: |
| 17 | br label %for.end |
| 18 | |
| 19 | bb.nph: |
| 20 | br label %for.body |
| 21 | |
| 22 | for.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 | |
| 35 | for.end: |
| 36 | ret void |
| 37 | } |
| 38 | |
| 39 | declare i64 @bar() |
| 40 | |
| 41 | declare i64 @car() |