Vedant Kumar | dcc410b | 2020-03-30 10:02:21 -0700 | [diff] [blame] | 1 | ; RUN: opt < %s -S -loop-vectorize -force-vector-width=4 -force-vector-interleave=1 | FileCheck %s |
| 2 | |
| 3 | ; Check that we can vectorize this loop without crashing. |
| 4 | |
| 5 | ; CHECK-LABEL: define {{.*}} @widget( |
| 6 | ; CHECK: [[vecInd:%.*]] = phi <4 x i8> [ <i8 0, i8 1, i8 2, i8 3> |
| 7 | ; CHECK-NEXT: add <4 x i8> [[vecInd]], <i8 1, i8 1, i8 1, i8 1> |
| 8 | |
| 9 | define i8 @widget(i8* %arr, i8 %t9) { |
| 10 | bb: |
| 11 | br label %bb6 |
| 12 | |
| 13 | bb6: |
| 14 | %t1.0 = phi i8* [ %arr, %bb ], [ null, %bb6 ] |
| 15 | %c = call i1 @cond() |
| 16 | br i1 %c, label %for.preheader, label %bb6 |
| 17 | |
| 18 | for.preheader: |
| 19 | br label %for.body |
| 20 | |
| 21 | for.body: |
| 22 | %iv = phi i8 [ %iv.next, %for.body ], [ 0, %for.preheader ] |
| 23 | %iv.next = add i8 %iv, 1 |
| 24 | %ptr = getelementptr inbounds i8, i8* %arr, i8 %iv.next |
| 25 | %t3.i = icmp slt i8 %iv.next, %t9 |
| 26 | %t3.i8 = zext i1 %t3.i to i8 |
| 27 | store i8 %t3.i8, i8* %ptr |
| 28 | %ec = icmp eq i8* %t1.0, %ptr |
| 29 | br i1 %ec, label %for.exit, label %for.body |
| 30 | |
| 31 | for.exit: |
| 32 | %iv.next.lcssa = phi i8 [ %iv.next, %for.body ] |
| 33 | ret i8 %iv.next.lcssa |
| 34 | } |
| 35 | |
| 36 | declare i1 @cond() |