aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/Analysis
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test/Analysis')
-rw-r--r--llvm/test/Analysis/DXILResource/buffer-frombinding.ll19
-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
3 files changed, 181 insertions, 0 deletions
diff --git a/llvm/test/Analysis/DXILResource/buffer-frombinding.ll b/llvm/test/Analysis/DXILResource/buffer-frombinding.ll
index ab1945d..d92010e 100644
--- a/llvm/test/Analysis/DXILResource/buffer-frombinding.ll
+++ b/llvm/test/Analysis/DXILResource/buffer-frombinding.ll
@@ -9,6 +9,7 @@
@Four.str = private unnamed_addr constant [5 x i8] c"Four\00", align 1
@Array.str = private unnamed_addr constant [6 x i8] c"Array\00", align 1
@Five.str = private unnamed_addr constant [5 x i8] c"Five\00", align 1
+@Six.str = private unnamed_addr constant [4 x i8] c"Six\00", align 1
@CB.str = private unnamed_addr constant [3 x i8] c"CB\00", align 1
@Constants.str = private unnamed_addr constant [10 x i8] c"Constants\00", align 1
@@ -137,6 +138,23 @@ define void @test_typedbuffer() {
; CHECK: Element Type: f32
; CHECK: Element Count: 4
+ %uav4 = call target("dx.TypedBuffer", double, 1, 0, 0)
+ @llvm.dx.resource.handlefrombinding(i32 5, i32 0, i32 1, i32 0, ptr @Six.str)
+ ; CHECK: Resource [[UAV4:[0-9]+]]:
+ ; CHECK: Name: Six
+ ; CHECK: Binding:
+ ; CHECK: Record ID: 4
+ ; CHECK: Space: 5
+ ; CHECK: Lower Bound: 0
+ ; CHECK: Size: 1
+ ; CHECK: Globally Coherent: 0
+ ; CHECK: Counter Direction: Unknown
+ ; CHECK: Class: UAV
+ ; CHECK: Kind: Buffer
+ ; CHECK: IsROV: 0
+ ; CHECK: Element Type: f64 (stored as u32)
+ ; CHECK: Element Count: 1
+
%cb0 = call target("dx.CBuffer", {float})
@llvm.dx.resource.handlefrombinding(i32 1, i32 0, i32 1, i32 0, ptr @CB.str)
; CHECK: Resource [[CB0:[0-9]+]]:
@@ -175,6 +193,7 @@ define void @test_typedbuffer() {
; CHECK-DAG: Call bound to [[UAV1]]: %uav1 =
; CHECK-DAG: Call bound to [[UAV2]]: %uav2_1 =
; CHECK-DAG: Call bound to [[UAV2]]: %uav2_2 =
+; CHECK-DAG: Call bound to [[UAV4]]: %uav4 =
; CHECK-DAG: Call bound to [[CB0]]: %cb0 =
; CHECK-DAG: Call bound to [[CB1]]: %cb1 =
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: