summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
diff options
context:
space:
mode:
authorDaniel Berlin <dberlin@dberlin.org>2016-06-01 18:55:32 +0000
committerDaniel Berlin <dberlin@dberlin.org>2016-06-01 18:55:32 +0000
commit73694bb92bfbe55ee2c7afc0e3cf4a186741aeb9 (patch)
tree25588ba85835d0b4ee91f773f570edbe08e48d04 /llvm/test/Transforms
parent18b83fe6cf7848d66f2797c231a81e96c2f61d2e (diff)
downloadbcm5719-llvm-73694bb92bfbe55ee2c7afc0e3cf4a186741aeb9.tar.gz
bcm5719-llvm-73694bb92bfbe55ee2c7afc0e3cf4a186741aeb9.zip
Revert "Claim NoAlias if two GEPs index different fields of the same struct"
This reverts commit 2d5d6493f43eb68493a3852b8c226ac9fafdc7eb. llvm-svn: 271422
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r--llvm/test/Transforms/LoopVectorize/global_alias.ll158
1 files changed, 81 insertions, 77 deletions
diff --git a/llvm/test/Transforms/LoopVectorize/global_alias.ll b/llvm/test/Transforms/LoopVectorize/global_alias.ll
index ae4e121cedf..0da841bcbbd 100644
--- a/llvm/test/Transforms/LoopVectorize/global_alias.ll
+++ b/llvm/test/Transforms/LoopVectorize/global_alias.ll
@@ -765,18 +765,22 @@ for.end: ; preds = %for.cond
ret i32 %7
}
-; /// Different objects, swapped induction
-; int noAlias15(int a) {
+
+;; === Now, the tests that we could vectorize with induction changes or run-time checks ===
+
+
+; /// Different objects, swapped induction, alias at the end
+; int mayAlias01 (int a) {
; int i;
; for (i=0; i<SIZE; i++)
; Foo.A[i] = Foo.B[SIZE-i-1] + a;
; return Foo.A[a];
; }
-; CHECK-LABEL: define i32 @noAlias15(
-; CHECK: add nsw <4 x i32>
+; CHECK-LABEL: define i32 @mayAlias01(
+; CHECK-NOT: add nsw <4 x i32>
; CHECK: ret
-define i32 @noAlias15(i32 %a) nounwind {
+define i32 @mayAlias01(i32 %a) nounwind {
entry:
%a.addr = alloca i32, align 4
%i = alloca i32, align 4
@@ -815,18 +819,18 @@ for.end: ; preds = %for.cond
ret i32 %7
}
-; /// Different objects, swapped induction
-; int noAlias16 (int a) {
+; /// Different objects, swapped induction, alias at the beginning
+; int mayAlias02 (int a) {
; int i;
; for (i=0; i<SIZE; i++)
; Foo.A[SIZE-i-1] = Foo.B[i] + a;
; return Foo.A[a];
; }
-; CHECK-LABEL: define i32 @noAlias16(
-; CHECK: add nsw <4 x i32>
+; CHECK-LABEL: define i32 @mayAlias02(
+; CHECK-NOT: add nsw <4 x i32>
; CHECK: ret
-define i32 @noAlias16(i32 %a) nounwind {
+define i32 @mayAlias02(i32 %a) nounwind {
entry:
%a.addr = alloca i32, align 4
%i = alloca i32, align 4
@@ -865,21 +869,75 @@ for.end: ; preds = %for.cond
ret i32 %7
}
+; /// Pointer access, run-time check added
+; int mayAlias03 (int a) {
+; int i;
+; for (i=0; i<SIZE; i++)
+; *(PA+i) = *(PB+SIZE-i-1) + a;
+; return *(PA+a);
+; }
+; CHECK-LABEL: define i32 @mayAlias03(
+; CHECK-NOT: add nsw <4 x i32>
+; CHECK: ret
+
+define i32 @mayAlias03(i32 %a) nounwind {
+entry:
+ %a.addr = alloca i32, align 4
+ %i = alloca i32, align 4
+ store i32 %a, i32* %a.addr, align 4
+ store i32 0, i32* %i, align 4
+ br label %for.cond
+
+for.cond: ; preds = %for.inc, %entry
+ %0 = load i32, i32* %i, align 4
+ %cmp = icmp slt i32 %0, 100
+ br i1 %cmp, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond
+ %1 = load i32*, i32** @PB, align 4
+ %add.ptr = getelementptr inbounds i32, i32* %1, i32 100
+ %2 = load i32, i32* %i, align 4
+ %idx.neg = sub i32 0, %2
+ %add.ptr1 = getelementptr inbounds i32, i32* %add.ptr, i32 %idx.neg
+ %add.ptr2 = getelementptr inbounds i32, i32* %add.ptr1, i32 -1
+ %3 = load i32, i32* %add.ptr2, align 4
+ %4 = load i32, i32* %a.addr, align 4
+ %add = add nsw i32 %3, %4
+ %5 = load i32*, i32** @PA, align 4
+ %6 = load i32, i32* %i, align 4
+ %add.ptr3 = getelementptr inbounds i32, i32* %5, i32 %6
+ store i32 %add, i32* %add.ptr3, align 4
+ br label %for.inc
+
+for.inc: ; preds = %for.body
+ %7 = load i32, i32* %i, align 4
+ %inc = add nsw i32 %7, 1
+ store i32 %inc, i32* %i, align 4
+ br label %for.cond
+
+for.end: ; preds = %for.cond
+ %8 = load i32*, i32** @PA, align 4
+ %9 = load i32, i32* %a.addr, align 4
+ %add.ptr4 = getelementptr inbounds i32, i32* %8, i32 %9
+ %10 = load i32, i32* %add.ptr4, align 4
+ ret i32 %10
+}
+
-;; === Ignore undefined behavior ===
+;; === Finally, the tests that should only vectorize with care (or if we ignore undefined behaviour at all) ===
-; int noAlias17(int a) {
+; int mustAlias01 (int a) {
; int i;
; for (i=0; i<SIZE; i++)
; Foo.A[i+10] = Foo.B[SIZE-i-1] + a;
; return Foo.A[a];
; }
-; CHECK-LABEL: define i32 @noAlias17(
-; CHECK: add nsw <4 x i32>
+; CHECK-LABEL: define i32 @mustAlias01(
+; CHECK-NOT: add nsw <4 x i32>
; CHECK: ret
-define i32 @noAlias17(i32 %a) nounwind {
+define i32 @mustAlias01(i32 %a) nounwind {
entry:
%a.addr = alloca i32, align 4
%i = alloca i32, align 4
@@ -919,17 +977,17 @@ for.end: ; preds = %for.cond
ret i32 %7
}
-; int noAlias18(int a) {
+; int mustAlias02 (int a) {
; int i;
; for (i=0; i<SIZE; i++)
; Foo.A[i] = Foo.B[SIZE-i-10] + a;
; return Foo.A[a];
; }
-; CHECK-LABEL: define i32 @noAlias18(
-; CHECK: add nsw <4 x i32>
+; CHECK-LABEL: define i32 @mustAlias02(
+; CHECK-NOT: add nsw <4 x i32>
; CHECK: ret
-define i32 @noAlias18(i32 %a) nounwind {
+define i32 @mustAlias02(i32 %a) nounwind {
entry:
%a.addr = alloca i32, align 4
%i = alloca i32, align 4
@@ -968,17 +1026,17 @@ for.end: ; preds = %for.cond
ret i32 %7
}
-; int noAlias19(int a) {
+; int mustAlias03 (int a) {
; int i;
; for (i=0; i<SIZE; i++)
; Foo.A[i+10] = Foo.B[SIZE-i-10] + a;
; return Foo.A[a];
; }
-; CHECK-LABEL: define i32 @noAlias19(
-; CHECK: add nsw <4 x i32>
+; CHECK-LABEL: define i32 @mustAlias03(
+; CHECK-NOT: add nsw <4 x i32>
; CHECK: ret
-define i32 @noAlias19(i32 %a) nounwind {
+define i32 @mustAlias03(i32 %a) nounwind {
entry:
%a.addr = alloca i32, align 4
%i = alloca i32, align 4
@@ -1017,57 +1075,3 @@ for.end: ; preds = %for.cond
%7 = load i32, i32* %arrayidx4, align 4
ret i32 %7
}
-
-; /// Pointer access, run-time check added
-; int mayAlias01 (int a) {
-; int i;
-; for (i=0; i<SIZE; i++)
-; *(PA+i) = *(PB+SIZE-i-1) + a;
-; return *(PA+a);
-; }
-; CHECK-LABEL: define i32 @mayAlias01(
-; CHECK-NOT: add nsw <4 x i32>
-; CHECK: ret
-
-define i32 @mayAlias01(i32 %a) nounwind {
-entry:
- %a.addr = alloca i32, align 4
- %i = alloca i32, align 4
- store i32 %a, i32* %a.addr, align 4
- store i32 0, i32* %i, align 4
- br label %for.cond
-
-for.cond: ; preds = %for.inc, %entry
- %0 = load i32, i32* %i, align 4
- %cmp = icmp slt i32 %0, 100
- br i1 %cmp, label %for.body, label %for.end
-
-for.body: ; preds = %for.cond
- %1 = load i32*, i32** @PB, align 4
- %add.ptr = getelementptr inbounds i32, i32* %1, i32 100
- %2 = load i32, i32* %i, align 4
- %idx.neg = sub i32 0, %2
- %add.ptr1 = getelementptr inbounds i32, i32* %add.ptr, i32 %idx.neg
- %add.ptr2 = getelementptr inbounds i32, i32* %add.ptr1, i32 -1
- %3 = load i32, i32* %add.ptr2, align 4
- %4 = load i32, i32* %a.addr, align 4
- %add = add nsw i32 %3, %4
- %5 = load i32*, i32** @PA, align 4
- %6 = load i32, i32* %i, align 4
- %add.ptr3 = getelementptr inbounds i32, i32* %5, i32 %6
- store i32 %add, i32* %add.ptr3, align 4
- br label %for.inc
-
-for.inc: ; preds = %for.body
- %7 = load i32, i32* %i, align 4
- %inc = add nsw i32 %7, 1
- store i32 %inc, i32* %i, align 4
- br label %for.cond
-
-for.end: ; preds = %for.cond
- %8 = load i32*, i32** @PA, align 4
- %9 = load i32, i32* %a.addr, align 4
- %add.ptr4 = getelementptr inbounds i32, i32* %8, i32 %9
- %10 = load i32, i32* %add.ptr4, align 4
- ret i32 %10
-}
OpenPOWER on IntegriCloud