|
39 | 39 | exit:
|
40 | 40 | ret void
|
41 | 41 | }
|
| 42 | + |
| 43 | +; Same as previous test, but with selects replaced by phis in the same block. |
| 44 | +define void @test_phi(ptr noalias %x, ptr noalias %y, ptr noalias %z) { |
| 45 | +; CHECK-LABEL: 'test_phi' |
| 46 | +; CHECK-NEXT: loop: |
| 47 | +; CHECK-NEXT: Memory dependences are safe |
| 48 | +; CHECK-NEXT: Dependences: |
| 49 | +; CHECK-NEXT: Run-time memory checks: |
| 50 | +; CHECK-NEXT: Grouped accesses: |
| 51 | +; CHECK-EMPTY: |
| 52 | +; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop. |
| 53 | +; CHECK-NEXT: SCEV assumptions: |
| 54 | +; CHECK-EMPTY: |
| 55 | +; CHECK-NEXT: Expressions re-written: |
| 56 | +; |
| 57 | +entry: |
| 58 | + %gep.y = getelementptr double, ptr %y, i64 -32 |
| 59 | + br label %loop |
| 60 | + |
| 61 | +loop: |
| 62 | + %iv = phi i64 [ %iv.next, %latch ], [ 0, %entry ] |
| 63 | + %icmp = icmp ule i64 %iv, 32 |
| 64 | + br i1 %icmp, label %if, label %latch |
| 65 | + |
| 66 | +if: |
| 67 | + br label %latch |
| 68 | + |
| 69 | +latch: |
| 70 | + %sel = phi ptr [ %x, %if ], [ %gep.y, %loop ] |
| 71 | + %sel2 = phi ptr [ %y, %if ], [ %z, %loop ] |
| 72 | + %gep.sel = getelementptr inbounds double, ptr %sel, i64 %iv |
| 73 | + %load = load double, ptr %gep.sel, align 8 |
| 74 | + %gep.sel2 = getelementptr inbounds double, ptr %sel2, i64 %iv |
| 75 | + store double %load, ptr %gep.sel2, align 8 |
| 76 | + %iv.next = add nuw nsw i64 %iv, 1 |
| 77 | + %exit.cond = icmp eq i64 %iv, 94 |
| 78 | + br i1 %exit.cond, label %exit, label %loop |
| 79 | + |
| 80 | +exit: |
| 81 | + ret void |
| 82 | +} |
0 commit comments