|
| 1 | +; RUN: opt -loop-vectorize -force-vector-width=2 %s -S -debug 2>&1 | FileCheck %s |
| 2 | +; RUN: opt -passes='loop-vectorize' -force-vector-width=2 %s -S -debug 2>&1 | FileCheck %s |
| 3 | + |
| 4 | +; REQUIRES: asserts |
| 5 | + |
| 6 | +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" |
| 7 | + |
| 8 | +; FIXME |
| 9 | +; Test case for PR47751. Make sure the runtime check includes a required |
| 10 | +; addition of the size of the element type (a pointer) for the end bound. |
| 11 | + |
| 12 | +define void @test(i64 %arg, i32 %arg1, i8** %base) { |
| 13 | +; CHECK: LAA: Adding RT check for range: |
| 14 | +; CHECK-NEXT: Start: ((8 * (zext i32 (-1 + %arg1)<nsw> to i64))<nuw><nsw> + (8 * (1 smin %arg)) + (-8 * %arg) + %base) |
| 15 | +; CHECK-SAME: End: ((8 * (zext i32 (-1 + %arg1)<nsw> to i64))<nuw><nsw> + %base) |
| 16 | +; CHECK-NEXT: LAA: Adding RT check for range: |
| 17 | +; CHECK-NEXT: Start: ((8 * (1 smin %arg)) + %base) |
| 18 | +; CHECK-SAME: End: ((8 * %arg) + %base)<nsw> |
| 19 | + |
| 20 | +; CHECK: vector.body |
| 21 | + |
| 22 | +entry: |
| 23 | + br label %loop |
| 24 | + |
| 25 | +loop: |
| 26 | + %iv.1 = phi i64 [ %arg, %entry ], [ %iv.1.next, %loop ] |
| 27 | + %iv.2 = phi i32 [ %arg1, %entry ], [ %iv.2.next, %loop ] |
| 28 | + %iv.2.next = add nsw i32 %iv.2, -1 |
| 29 | + %iv.2.ext = zext i32 %iv.2.next to i64 |
| 30 | + %idx.1 = getelementptr inbounds i8*, i8** %base, i64 %iv.2.ext |
| 31 | + %v.1 = load i8*, i8** %idx.1, align 8 |
| 32 | + %idx.2 = getelementptr inbounds i8*, i8** %base, i64 %iv.1 |
| 33 | + %v.2 = load i8*, i8** %idx.2, align 8 |
| 34 | + store i8* %v.2, i8** %idx.1, align 8 |
| 35 | + store i8* %v.1, i8** %idx.2, align 8 |
| 36 | + %tmp11 = icmp sgt i64 %iv.1, 1 |
| 37 | + %iv.1.next = add nsw i64 %iv.1, -1 |
| 38 | + br i1 %tmp11, label %loop, label %exit |
| 39 | + |
| 40 | +exit: ; preds = %bb3 |
| 41 | + ret void |
| 42 | +} |
0 commit comments