Dan Gohman | 5a1645e | 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 |
Kenneth Uildriks | a092c12 | 2009-11-03 15:29:06 +0000 | [diff] [blame] | 5 | target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128" |
Dan Gohman | 5a1645e | 2009-09-26 16:11:57 +0000 | [diff] [blame] | 6 | |
| 7 | ; Indvars shouldn't need inttoptr/ptrtoint to expand an address here. |
| 8 | |
| 9 | define void @foo(i8* %p) nounwind { |
| 10 | entry: |
| 11 | br i1 true, label %bb.nph, label %for.end |
| 12 | |
| 13 | for.cond: |
| 14 | %phitmp = icmp slt i64 %inc, 20 |
| 15 | br i1 %phitmp, label %for.body, label %for.cond.for.end_crit_edge |
| 16 | |
| 17 | for.cond.for.end_crit_edge: |
| 18 | br label %for.end |
| 19 | |
| 20 | bb.nph: |
| 21 | br label %for.body |
| 22 | |
| 23 | for.body: |
| 24 | %storemerge1 = phi i64 [ %inc, %for.cond ], [ 0, %bb.nph ] |
| 25 | %call = tail call i64 @bar() nounwind |
| 26 | %call2 = tail call i64 @car() nounwind |
| 27 | %conv = trunc i64 %call2 to i8 |
| 28 | %conv3 = sext i8 %conv to i64 |
| 29 | %add = add nsw i64 %call, %storemerge1 |
| 30 | %add4 = add nsw i64 %add, %conv3 |
| 31 | %arrayidx = getelementptr inbounds i8* %p, i64 %add4 |
| 32 | store i8 0, i8* %arrayidx |
| 33 | %inc = add nsw i64 %storemerge1, 1 |
| 34 | br label %for.cond |
| 35 | |
| 36 | for.end: |
| 37 | ret void |
| 38 | } |
| 39 | |
| 40 | declare i64 @bar() |
| 41 | |
| 42 | declare i64 @car() |