aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/Analysis
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test/Analysis')
-rw-r--r--llvm/test/Analysis/DependenceAnalysis/same-sd-for-diff-becount-type-loops.ll68
-rw-r--r--llvm/test/Analysis/LoopAccessAnalysis/inbounds-gep-in-predicated-blocks.ll94
2 files changed, 162 insertions, 0 deletions
diff --git a/llvm/test/Analysis/DependenceAnalysis/same-sd-for-diff-becount-type-loops.ll b/llvm/test/Analysis/DependenceAnalysis/same-sd-for-diff-becount-type-loops.ll
new file mode 100644
index 0000000..66880b5
--- /dev/null
+++ b/llvm/test/Analysis/DependenceAnalysis/same-sd-for-diff-becount-type-loops.ll
@@ -0,0 +1,68 @@
+; RUN: opt < %s -disable-output "-passes=print<da>" -aa-pipeline=basic-aa 2>&1 | FileCheck %s
+
+define void @f1() {
+; CHECK-LABEL: 'f1'
+; CHECK-NEXT: Src: store i32 0, ptr null, align 4 --> Dst: store i32 0, ptr null, align 4
+; CHECK-NEXT: da analyze - consistent output [S]!
+; CHECK-NEXT: Src: store i32 0, ptr null, align 4 --> Dst: %2 = load i32, ptr null, align 4
+; CHECK-NEXT: da analyze - consistent flow [|<]!
+; CHECK-NEXT: Src: %2 = load i32, ptr null, align 4 --> Dst: %2 = load i32, ptr null, align 4
+; CHECK-NEXT: da analyze - consistent input [S]!
+;
+entry:
+ br label %for.1.header
+
+for.1.header: ; preds = %for.2.end, %entry
+ br label %for.1.body
+
+for.1.body: ; preds = %for.1.body, %whiledo
+ %0 = phi i32 [ 0, %for.1.header ], [ 1, %for.1.body ]
+ store i32 0, ptr null, align 4
+ %1 = icmp ult i32 %0, 1
+ br i1 %1, label %for.1.body, label %for.1.end
+
+for.1.end: ; preds = %for.1.body
+ br label %for.2.body
+
+for.2.body: ; preds = %for.2.body, %for.1.end
+ %2 = load i32, ptr null, align 4
+ br i1 false, label %for.2.body, label %exit
+
+exit: ; preds = %for.2.body
+ ret void
+}
+
+define void @f2() {
+; CHECK-LABEL: 'f2'
+; CHECK-NEXT: Src: store i32 0, ptr null, align 4 --> Dst: store i32 0, ptr null, align 4
+; CHECK-NEXT: da analyze - consistent output [S]!
+; CHECK-NEXT: Src: store i32 0, ptr null, align 4 --> Dst: %3 = load i32, ptr null, align 4
+; CHECK-NEXT: da analyze - flow [|<] / assuming 1 loop level(s) fused: [S|<]!
+; CHECK-NEXT: Src: %3 = load i32, ptr null, align 4 --> Dst: %3 = load i32, ptr null, align 4
+; CHECK-NEXT: da analyze - consistent input [S]!
+;
+entry:
+ br label %for.1.header
+
+for.1.header: ; preds = %for.2.end, %entry
+ br label %for.1.body
+
+for.1.body: ; preds = %for.1.body, %whiledo
+ %0 = phi i32 [ 0, %for.1.header ], [ 1, %for.1.body ]
+ store i32 0, ptr null, align 4
+ %1 = icmp ult i32 %0, 1
+ br i1 %1, label %for.1.body, label %for.1.end
+
+for.1.end: ; preds = %for.1.body
+ br label %for.2.body
+
+for.2.body: ; preds = %for.2.body, %for.1.end
+ %2 = phi i64 [ 0, %for.1.end ], [ %4, %for.2.body ]
+ %3 = load i32, ptr null, align 4
+ %4 = add nuw nsw i64 %2, 1
+ %5 = icmp ult i64 %4, 2
+ br i1 %5, label %for.2.body, label %exit
+
+exit: ; preds = %for.2.body
+ ret void
+}
diff --git a/llvm/test/Analysis/LoopAccessAnalysis/inbounds-gep-in-predicated-blocks.ll b/llvm/test/Analysis/LoopAccessAnalysis/inbounds-gep-in-predicated-blocks.ll
index 6eed0ec..4c2a9c3 100644
--- a/llvm/test/Analysis/LoopAccessAnalysis/inbounds-gep-in-predicated-blocks.ll
+++ b/llvm/test/Analysis/LoopAccessAnalysis/inbounds-gep-in-predicated-blocks.ll
@@ -54,6 +54,100 @@ exit:
ret void
}
+; Same as @test_inbounds_gep_used_in_predicated_block, but also storing the
+; pointer values in the header.
+define void @test_inbounds_gep_used_in_predicated_block_stored_value_operand(ptr %A, i64 %n, ptr noalias %B) {
+; CHECK-LABEL: 'test_inbounds_gep_used_in_predicated_block_stored_value_operand'
+; CHECK-NEXT: loop.header:
+; CHECK-NEXT: Memory dependences are safe
+; CHECK-NEXT: Dependences:
+; CHECK-NEXT: Run-time memory checks:
+; CHECK-NEXT: Grouped accesses:
+; CHECK-EMPTY:
+; CHECK-NEXT: Non vectorizable stores to invariant address were found in loop.
+; CHECK-NEXT: SCEV assumptions:
+; CHECK-EMPTY:
+; CHECK-NEXT: Expressions re-written:
+;
+entry:
+ br label %loop.header
+
+loop.header:
+ %i = phi i64 [ 0, %entry ], [ %i.next, %loop.latch ]
+ %offset.0 = phi i64 [ 0, %entry ], [ %offset.0.next, %loop.latch ]
+ %offset.1 = phi i64 [ 0, %entry ], [ %offset.1.next, %loop.latch ]
+ %idx.0 = getelementptr inbounds i8, ptr %A, i64 %offset.0
+ %idx.1 = getelementptr inbounds i8, ptr %A, i64 %offset.1
+ %mask = and i64 %i, 3
+ %cond = icmp eq i64 %mask, 0
+ store ptr %idx.0, ptr %B
+ store ptr %idx.1, ptr %B
+ br i1 %cond, label %if.then, label %loop.latch
+
+if.then:
+ store i8 2, ptr %idx.0
+ store i8 1, ptr %idx.1
+ br label %loop.latch
+
+loop.latch:
+ %i.next = add nuw nsw i64 %i, 1
+ %offset.0.next = add i64 %offset.0, 4611686018427387905 ; 2^62 + 1
+ %offset.1.next = add i64 %offset.1, 4611686018427387906 ; 2^62 + 2
+ %cond.exit = icmp eq i64 %i.next, 100
+ br i1 %cond.exit, label %exit, label %loop.header
+
+exit:
+ ret void
+}
+
+; Same as @test_inbounds_gep_used_in_predicated_block_non_memop_user, but with
+; extra GEP users in the header.
+define void @test_inbounds_gep_used_in_predicated_block_non_memop_user(ptr %A, i64 %n) {
+; CHECK-LABEL: 'test_inbounds_gep_used_in_predicated_block_non_memop_user'
+; CHECK-NEXT: loop.header:
+; CHECK-NEXT: Memory dependences are safe
+; CHECK-NEXT: Dependences:
+; CHECK-NEXT: Run-time memory checks:
+; CHECK-NEXT: Grouped accesses:
+; CHECK-EMPTY:
+; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
+; CHECK-NEXT: SCEV assumptions:
+; CHECK-EMPTY:
+; CHECK-NEXT: Expressions re-written:
+;
+entry:
+ br label %loop.header
+
+loop.header:
+ %i = phi i64 [ 0, %entry ], [ %i.next, %loop.latch ]
+ %offset.0 = phi i64 [ 0, %entry ], [ %offset.0.next, %loop.latch ]
+ %offset.1 = phi i64 [ 0, %entry ], [ %offset.1.next, %loop.latch ]
+ %idx.0 = getelementptr inbounds i8, ptr %A, i64 %offset.0
+ %idx.1 = getelementptr inbounds i8, ptr %A, i64 %offset.1
+ %mask = and i64 %i, 3
+ %cond = icmp eq i64 %mask, 0
+ %gep.idx.0 = getelementptr inbounds i8, ptr %idx.0, i8 1
+ %gep.idx.1 = getelementptr inbounds i8, ptr %idx.1, i8 1
+ br i1 %cond, label %if.then, label %loop.latch
+
+if.then:
+ store i8 2, ptr %idx.0
+ store i8 1, ptr %idx.1
+ br label %loop.latch
+
+loop.latch:
+ %i.next = add nuw nsw i64 %i, 1
+ %offset.0.next = add i64 %offset.0, 4611686018427387905 ; 2^62 + 1
+ %offset.1.next = add i64 %offset.1, 4611686018427387906 ; 2^62 + 2
+ %cond.exit = icmp eq i64 %i.next, 100
+ br i1 %cond.exit, label %exit, label %loop.header
+
+exit:
+ store i32 0, ptr %gep.idx.0
+ store i32 0, ptr %gep.idx.1
+ ret void
+}
+
define void @test_header_existing(ptr %src, ptr %dst, i64 %start) {
; CHECK-LABEL: 'test_header_existing'
; CHECK-NEXT: loop.header: