diff options
Diffstat (limited to 'llvm/test')
4 files changed, 49 insertions, 2 deletions
diff --git a/llvm/test/Analysis/LoopDependenceAnalysis/local-array.ll b/llvm/test/Analysis/LoopDependenceAnalysis/local-array.ll new file mode 100644 index 00000000000..c42e0fad438 --- /dev/null +++ b/llvm/test/Analysis/LoopDependenceAnalysis/local-array.ll @@ -0,0 +1,24 @@ +; RUN: llvm-as < %s | opt -disable-output -analyze -lda > %t +; RUN: grep {instructions: 2} %t | count 1 +; RUN: grep {0,1: dependent} %t | count 1 + +; x[5] = x[6] // with x being an array on the stack + +define void @foo(...) nounwind { +entry: + %xptr = alloca [256 x i32], align 4 + %x.ld.addr = getelementptr [256 x i32]* %xptr, i64 0, i64 6 + %x.st.addr = getelementptr [256 x i32]* %xptr, i64 0, i64 5 + br label %for.body + +for.body: + %i = phi i64 [ 0, %entry ], [ %i.next, %for.body ] + %x = load i32* %x.ld.addr + store i32 %x, i32* %x.st.addr + %i.next = add i64 %i, 1 + %exitcond = icmp eq i64 %i.next, 256 + br i1 %exitcond, label %for.end, label %for.body + +for.end: + ret void +} diff --git a/llvm/test/Analysis/LoopDependenceAnalysis/no-array.ll b/llvm/test/Analysis/LoopDependenceAnalysis/no-array.ll new file mode 100644 index 00000000000..03b9f4d8b8d --- /dev/null +++ b/llvm/test/Analysis/LoopDependenceAnalysis/no-array.ll @@ -0,0 +1,23 @@ +; RUN: llvm-as < %s | opt -disable-output -analyze -lda > %t +; RUN: grep {instructions: 2} %t | count 1 +; RUN: grep {0,1: dependent} %t | count 1 + +; x[5] = x[6] // with x being a pointer passed as argument + +define void @foo(i32* nocapture %xptr) nounwind { +entry: + %x.ld.addr = getelementptr i32* %xptr, i64 6 + %x.st.addr = getelementptr i32* %xptr, i64 5 + br label %for.body + +for.body: + %i = phi i64 [ 0, %entry ], [ %i.next, %for.body ] + %x = load i32* %x.ld.addr + store i32 %x, i32* %x.st.addr + %i.next = add i64 %i, 1 + %exitcond = icmp eq i64 %i.next, 256 + br i1 %exitcond, label %for.end, label %for.body + +for.end: + ret void +} diff --git a/llvm/test/Analysis/LoopDependenceAnalysis/siv-strong1.ll b/llvm/test/Analysis/LoopDependenceAnalysis/siv-strong1.ll index 01f11137d78..c416ff377fb 100644 --- a/llvm/test/Analysis/LoopDependenceAnalysis/siv-strong1.ll +++ b/llvm/test/Analysis/LoopDependenceAnalysis/siv-strong1.ll @@ -1,7 +1,7 @@ ; RUN: llvm-as < %s | opt -disable-output -analyze -lda > %t ; RUN: grep {instructions: 3} %t | count 1 ; RUN: grep {0,2: dependent} %t | count 1 -; RUN: grep {1,2: dependent} %t | count 1 +; RUN: grep {1,2: independent} %t | count 1 ; for (i = 0; i < 256; i++) ; x[i] = x[i] + y[i] diff --git a/llvm/test/Analysis/LoopDependenceAnalysis/siv-strong2.ll b/llvm/test/Analysis/LoopDependenceAnalysis/siv-strong2.ll index e64b92c3e76..7295863e378 100644 --- a/llvm/test/Analysis/LoopDependenceAnalysis/siv-strong2.ll +++ b/llvm/test/Analysis/LoopDependenceAnalysis/siv-strong2.ll @@ -1,7 +1,7 @@ ; RUN: llvm-as < %s | opt -disable-output -analyze -lda > %t ; RUN: grep {instructions: 3} %t | count 1 ; RUN: grep {0,2: dependent} %t | count 1 -; RUN: grep {1,2: dependent} %t | count 1 +; RUN: grep {1,2: independent} %t | count 1 ; for (i = 0; i < 256; i++) ; x[i+1] = x[i] + y[i] |