Brendon Cahoon | 254f889 | 2016-07-29 16:44:44 +0000 | [diff] [blame] | 1 | ; RUN: llc -march=hexagon -mcpu=hexagonv5 -enable-pipeliner -pipeliner-max-stages=2 < %s |
| 2 | ; REQUIRES: asserts |
| 3 | |
| 4 | ; This tests check that a dependence is created between a Phi and it's uses. |
| 5 | ; An assert occurs if the Phi dependences are not correct. |
| 6 | |
| 7 | define void @test1(i32* %f2, i32 %nc) { |
| 8 | entry: |
| 9 | %i.011 = add i32 %nc, -1 |
| 10 | %cmp12 = icmp sgt i32 %i.011, 1 |
| 11 | br i1 %cmp12, label %for.body.preheader, label %for.end |
| 12 | |
| 13 | for.body.preheader: |
| 14 | %0 = add i32 %nc, -2 |
| 15 | %scevgep = getelementptr i32, i32* %f2, i32 %0 |
| 16 | %sri = load i32, i32* %scevgep, align 4 |
| 17 | %scevgep15 = getelementptr i32, i32* %f2, i32 %i.011 |
| 18 | %sri16 = load i32, i32* %scevgep15, align 4 |
| 19 | br label %for.body |
| 20 | |
| 21 | for.body: |
| 22 | %i.014 = phi i32 [ %i.0, %for.body ], [ %i.011, %for.body.preheader ] |
| 23 | %i.0.in13 = phi i32 [ %i.014, %for.body ], [ %nc, %for.body.preheader ] |
| 24 | %sr = phi i32 [ %1, %for.body ], [ %sri, %for.body.preheader ] |
| 25 | %sr17 = phi i32 [ %sr, %for.body ], [ %sri16, %for.body.preheader ] |
| 26 | %arrayidx = getelementptr inbounds i32, i32* %f2, i32 %i.014 |
| 27 | %sub1 = add nsw i32 %i.0.in13, -3 |
| 28 | %arrayidx2 = getelementptr inbounds i32, i32* %f2, i32 %sub1 |
| 29 | %1 = load i32, i32* %arrayidx2, align 4 |
| 30 | %sub3 = sub nsw i32 %sr17, %1 |
| 31 | store i32 %sub3, i32* %arrayidx, align 4 |
| 32 | %i.0 = add nsw i32 %i.014, -1 |
| 33 | %cmp = icmp sgt i32 %i.0, 1 |
| 34 | br i1 %cmp, label %for.body, label %for.end.loopexit |
| 35 | |
| 36 | for.end.loopexit: |
| 37 | br label %for.end |
| 38 | |
| 39 | for.end: |
| 40 | ret void |
| 41 | } |
| 42 | |