Imported Upstream version 5.18.0.246

Former-commit-id: 0c7ce5b1a7851e13f22acfd379b7f9fb304e4833
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2019-01-23 08:21:40 +00:00
parent a7724cd563
commit 279aa8f685
28482 changed files with 3866972 additions and 44 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,80 @@
; RUN: opt < %s -analyze -basicaa -da | FileCheck %s
; Test that the dependence analysis generates the correct results when using
; an aliased object that points to a different element in the same array.
; PR33567 - https://bugs.llvm.org/show_bug.cgi?id=33567
; void test1(int *A, int *B, int N) {
; int *top = A;
; int *bot = A + N/2;
; for (int i = 0; i < N; i++)
; B[i] = top[i] + bot[i];
; }
; CHECK-LABEL: test1
; CHECK: da analyze - input [*|<]!
define void @test1(i32* nocapture %A, i32* nocapture %B, i32 %N) #0 {
entry:
%cmp9 = icmp sgt i32 %N, 0
br i1 %cmp9, label %for.body.lr.ph, label %for.end
for.body.lr.ph:
%div = sdiv i32 %N, 2
%bot.gep = getelementptr i32, i32* %A, i32 %div
br label %for.body
for.body:
%i = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.body ]
%gep.0 = getelementptr i32, i32* %A, i32 %i
%gep.1 = getelementptr i32, i32* %bot.gep, i32 %i
%gep.B = getelementptr i32, i32* %B, i32 %i
%0 = load i32, i32* %gep.0, align 4
%1 = load i32, i32* %gep.1, align 4
%add = add nsw i32 %1, %0
store i32 %add, i32* %gep.B, align 4
%inc = add nsw i32 %i, 1
%exitcond = icmp eq i32 %inc, %N
br i1 %exitcond, label %for.end, label %for.body
for.end:
ret void
}
; void test2(int *A, unsigned n) {
; int *B = A + 1;
; for (unsigned i = 0; i < n; ++i) {
; A[i] = B[i];
; }
; }
; CHECK-LABEL: test2
; CHECK: da analyze - consistent anti [1]!
define void @test2(i32*, i32) #3 {
%3 = getelementptr inbounds i32, i32* %0, i64 1
br label %4
; <label>:4:
%.0 = phi i32 [ 0, %2 ], [ %14, %13 ]
%5 = sub i32 %1, 1
%6 = icmp ult i32 %.0, %5
br i1 %6, label %7, label %15
; <label>:7:
%8 = zext i32 %.0 to i64
%9 = getelementptr inbounds i32, i32* %3, i64 %8
%10 = load i32, i32* %9, align 4
%11 = zext i32 %.0 to i64
%12 = getelementptr inbounds i32, i32* %0, i64 %11
store i32 %10, i32* %12, align 4
br label %13
; <label>:13:
%14 = add i32 %.0, 1
br label %4
; <label>:15:
ret void
}

View File

@@ -0,0 +1,103 @@
; RUN: opt < %s -analyze -basicaa -da
;; Check that this code doesn't abort. Test case is reduced version of lnt Polybench benchmark test case dynprog.
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
@sum_c = common global [10 x [10 x [10 x i32]]] zeroinitializer
@c = common global [10 x [10 x i32]] zeroinitializer
@W = common global [10 x [10 x i32]] zeroinitializer
@out_l = common global i32 0
; Function Attrs: nounwind uwtable
define void @dep_constraint_crash_test(i32 %M, i32 %N) {
%1 = icmp sgt i32 %N, 0
br i1 %1, label %.preheader.lr.ph, label %35
.preheader.lr.ph: ; preds = %0
%2 = add nsw i32 %M, -2
%3 = icmp slt i32 %M, 2
%4 = add nsw i32 %M, -1
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* @c, i64 0, i64 0, i64 %5
%7 = add nsw i32 %M, -1
%out_l.promoted = load i32, i32* @out_l
%8 = sext i32 %7 to i64
%9 = sext i32 %2 to i64
br label %.preheader
.preheader: ; preds = %._crit_edge7, %.preheader.lr.ph
%10 = phi i32 [ %out_l.promoted, %.preheader.lr.ph ], [ %33, %._crit_edge7 ]
%iter.08 = phi i32 [ 0, %.preheader.lr.ph ], [ %34, %._crit_edge7 ]
br i1 %3, label %._crit_edge7, label %.lr.ph6
.loopexit: ; preds = %._crit_edge, %.lr.ph6
%11 = icmp slt i64 %indvars.iv23, %9
%indvars.iv.next18 = add nuw nsw i64 %indvars.iv17, 1
%indvars.iv.next14 = add nuw i32 %indvars.iv13, 1
br i1 %11, label %.lr.ph6, label %._crit_edge7
.lr.ph6: ; preds = %.preheader, %.loopexit
%indvars.iv23 = phi i64 [ %indvars.iv.next24, %.loopexit ], [ 0, %.preheader ]
%indvars.iv17 = phi i64 [ %indvars.iv.next18, %.loopexit ], [ 1, %.preheader ]
%indvars.iv13 = phi i32 [ %indvars.iv.next14, %.loopexit ], [ 1, %.preheader ]
%indvars.iv.next24 = add nuw nsw i64 %indvars.iv23, 1
%12 = icmp slt i64 %indvars.iv23, %8
br i1 %12, label %.lr.ph4, label %.loopexit
.lr.ph4: ; preds = %.lr.ph6, %._crit_edge
%indvars.iv19 = phi i64 [ %indvars.iv.next20, %._crit_edge ], [ %indvars.iv17, %.lr.ph6 ]
%indvars.iv15 = phi i32 [ %indvars.iv.next16, %._crit_edge ], [ %indvars.iv13, %.lr.ph6 ]
%13 = getelementptr inbounds [10 x [10 x [10 x i32]]], [10 x [10 x [10 x i32]]]* @sum_c, i64 0, i64 %indvars.iv23, i64 %indvars.iv19, i64 %indvars.iv23
store i32 0, i32* %13
%14 = add nsw i64 %indvars.iv19, -1
%15 = icmp slt i64 %indvars.iv23, %14
br i1 %15, label %.lr.ph, label %._crit_edge
.lr.ph: ; preds = %.lr.ph4, %.lr.ph
%indvars.iv11 = phi i64 [ %indvars.iv.next12, %.lr.ph ], [ %indvars.iv17, %.lr.ph4 ]
%16 = add nsw i64 %indvars.iv11, -1
%17 = getelementptr inbounds [10 x [10 x [10 x i32]]], [10 x [10 x [10 x i32]]]* @sum_c, i64 0, i64 %indvars.iv23, i64 %indvars.iv19, i64 %16
%18 = load i32, i32* %17
%19 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* @c, i64 0, i64 %indvars.iv23, i64 %indvars.iv11
%20 = load i32, i32* %19
%21 = add nsw i32 %20, %18
%22 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* @c, i64 0, i64 %indvars.iv11, i64 %indvars.iv19
%23 = load i32, i32* %22
%24 = add nsw i32 %21, %23
%25 = getelementptr inbounds [10 x [10 x [10 x i32]]], [10 x [10 x [10 x i32]]]* @sum_c, i64 0, i64 %indvars.iv23, i64 %indvars.iv19, i64 %indvars.iv11
store i32 %24, i32* %25
%indvars.iv.next12 = add nuw nsw i64 %indvars.iv11, 1
%lftr.wideiv = trunc i64 %indvars.iv.next12 to i32
%exitcond = icmp eq i32 %lftr.wideiv, %indvars.iv15
br i1 %exitcond, label %._crit_edge, label %.lr.ph
._crit_edge: ; preds = %.lr.ph, %.lr.ph4
%26 = getelementptr inbounds [10 x [10 x [10 x i32]]], [10 x [10 x [10 x i32]]]* @sum_c, i64 0, i64 %indvars.iv23, i64 %indvars.iv19, i64 %14
%27 = load i32, i32* %26
%28 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* @W, i64 0, i64 %indvars.iv23, i64 %indvars.iv19
%29 = load i32, i32* %28
%30 = add nsw i32 %29, %27
%31 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* @c, i64 0, i64 %indvars.iv23, i64 %indvars.iv19
store i32 %30, i32* %31
%indvars.iv.next16 = add nuw i32 %indvars.iv15, 1
%indvars.iv.next20 = add nuw nsw i64 %indvars.iv19, 1
%lftr.wideiv21 = trunc i64 %indvars.iv.next20 to i32
%exitcond22 = icmp eq i32 %lftr.wideiv21, %M
br i1 %exitcond22, label %.loopexit, label %.lr.ph4
._crit_edge7: ; preds = %.loopexit, %.preheader
%32 = load i32, i32* %6
%33 = add nsw i32 %10, %32
%34 = add nuw nsw i32 %iter.08, 1
%exitcond25 = icmp eq i32 %34, %N
br i1 %exitcond25, label %._crit_edge9, label %.preheader
._crit_edge9: ; preds = %._crit_edge7
store i32 %33, i32* @out_l
br label %35
; <label>:35 ; preds = %._crit_edge9, %0
ret void
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,40 @@
; RUN: opt < %s -analyze -basicaa -da | FileCheck %s
; Test for a bug, which caused an assert when an invalid
; SCEVAddRecExpr is created in addToCoefficient.
; CHECK: da analyze - consistent input [S 0]!
; CHECK: da analyze - input [* 0|<]!
; CHECK: da analyze - none!
define float @foo(float %g, [40 x float]* %rr) nounwind {
entry:
br label %for.cond1.preheader
for.cond1.preheader:
%i.04 = phi i32 [ 0, %entry ], [ %add10, %for.inc9 ]
%res.03 = phi float [ 0.000000e+00, %entry ], [ %add.res.1, %for.inc9 ]
br label %for.body3
for.body3:
%j.02 = phi i32 [ 0, %for.cond1.preheader ], [ %add8, %for.body3 ]
%res.11 = phi float [ %res.03, %for.cond1.preheader ], [ %add.res.1, %for.body3 ]
%arrayidx4 = getelementptr inbounds [40 x float], [40 x float]* %rr, i32 %j.02, i32 %j.02
%0 = load float, float* %arrayidx4, align 4
%arrayidx6 = getelementptr inbounds [40 x float], [40 x float]* %rr, i32 %i.04, i32 %j.02
%1 = load float, float* %arrayidx6, align 4
%add = fadd float %0, %1
%cmp7 = fcmp ogt float %add, %g
%add.res.1 = select i1 %cmp7, float %add, float %res.11
%add8 = add nsw i32 %j.02, 5
%cmp2 = icmp slt i32 %add8, 40
br i1 %cmp2, label %for.body3, label %for.inc9
for.inc9:
%add10 = add nsw i32 %i.04, 5
%cmp = icmp slt i32 %add10, 40
br i1 %cmp, label %for.cond1.preheader, label %for.end11
for.end11:
ret float %add.res.1
}

View File

@@ -0,0 +1,73 @@
; RUN: opt < %s -analyze -basicaa -da
; Test that the dependence analysis pass does seg-fault due to a null pointer
; dereference. The code in gcdMIVTest requires a null check for the result of
; getConstantPart.
target datalayout = "e-m:e-p:32:32-i1:32-i64:64-a:0-v32:32-n16:32"
%0 = type { i32 }
%1 = type { [2 x [512 x %0]], [512 x %0], %2, [144 x i8], %9, %10, %11, %12, %17, [12 x i8], %18, %19, %21, [128 x i8] }
%2 = type { [64 x i16], [64 x i16], [64 x %0], [64 x %0], [128 x %0], [128 x %0], [256 x %0], [256 x %0], [32 x %0], [32 x %0], [64 x i16], [64 x i16], [64 x i16], [64 x i16], [64 x i16], %3, %4, %5, [32 x i32], [32 x i32], [32 x i32], [32 x i32], [32 x i32], [32 x i32], %6, %7, [32 x i32], [32 x i32], [32 x i32], [64 x i16], %8, [8 x i64], [4 x i64], [2 x i64], [256 x i8], [256 x i32], [64 x i16], [64 x i16] }
%3 = type { [64 x i32], [32 x i32], [32 x i32], [32 x i32], [32 x i32], [32 x i32], [32 x i32], [32 x i32], [32 x i32], [32 x i32], [32 x i32], [32 x i32], [32 x i32], [32 x i32], [32 x i32], [64 x i32], [64 x i32], [64 x i32], [64 x i32], [64 x i32], [64 x i32], [64 x i32], [64 x i32], [64 x i32], [64 x i16], [64 x i16], [64 x i16], [64 x i16], [64 x i16], [64 x i16], [64 x i16], [64 x i16], [64 x i16], [64 x i16], [64 x i16], [64 x i16], [32 x %0], [32 x %0], [128 x i8] }
%4 = type { [64 x i16], [64 x i16], [64 x i16], [64 x i16], [64 x i16], [64 x i16], [64 x i16], [64 x i16] }
%5 = type { [128 x i8], [256 x i8], [256 x i8] }
%6 = type { [64 x i32], [128 x i16], [64 x i16], [64 x i16], [64 x i16] }
%7 = type { [192 x %0], [192 x %0], [384 x %0], [1984 x %0] }
%8 = type { [128 x i8], [128 x i8], [64 x i16], [64 x i16], [64 x i16], [64 x i16], [64 x i16], [64 x i16] }
%9 = type { [32 x %0], [32 x %0], [64 x i32], [64 x i32], [64 x i32], [64 x i32] }
%10 = type { [1536 x %0], [2048 x %0], [512 x i32], [256 x i32], [32 x %0], [64 x i32], [128 x i8], [512 x i32], [1024 x %0] }
%11 = type { [512 x i32], [512 x i32], [1024 x %0], [512 x i32], [512 x %0] }
%12 = type { %13, [2048 x %0], [2048 x %0], [256 x i32], [1024 x i32], %14, [512 x %0], [256 x i32], %15, [4 x [256 x %0]], [4 x [256 x %0]], [256 x i32], [8 x [32 x i32]], [8 x [32 x %0]], [384 x %0], [256 x i32], %16 }
%13 = type { [2048 x %0] }
%14 = type { [1024 x %0], [1024 x %0] }
%15 = type { [256 x %0], [256 x %0] }
%16 = type { [128 x %0], [128 x %0] }
%17 = type { [32 x %0], [32 x i32], [32 x i32], [32 x i32], [32 x i32], [2 x [8 x [32 x %0]]], [512 x %0], [512 x %0], [58 x i16] }
%18 = type { [512 x i8] }
%19 = type { [2048 x %0], [2560 x i16], %20, [512 x i32], [256 x i32], [512 x i8] }
%20 = type { [768 x i32] }
%21 = type { [416 x i32] }
define void @test(%1* %A) #0 align 2 {
entry:
%v1 = load i32, i32* undef, align 4
br label %bb13
bb13:
%v2 = phi i32 [ undef, %entry ], [ %v39, %bb38 ]
br i1 undef, label %bb15, label %bb38
bb15:
%v3 = mul nsw i32 %v2, undef
br label %bb17
bb17:
br i1 undef, label %bb21, label %bb37
bb21:
%v22 = add nsw i32 undef, 1
%v23 = add i32 %v22, %v3
%v24 = mul nsw i32 %v23, %v1
%v25 = getelementptr inbounds %1, %1* %A, i32 0, i32 7, i32 1, i32 %v24
%v26 = bitcast %0* %v25 to <32 x i32>*
%v27 = load <32 x i32>, <32 x i32>* %v26, align 256
%v28 = add i32 undef, %v3
%v29 = mul nsw i32 %v28, 32
%v30 = getelementptr inbounds %1, %1* %A, i32 0, i32 7, i32 14, i32 %v29
%v31 = bitcast %0* %v30 to <32 x i32>*
%v32 = load <32 x i32>, <32 x i32>* %v31, align 128
br i1 undef, label %bb21, label %bb37
bb37:
br i1 undef, label %bb17, label %bb38
bb38:
%v39 = add nsw i32 %v2, 1
br label %bb13
bb40:
ret void
}
attributes #0 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }

View File

@@ -0,0 +1,36 @@
; RUN: opt < %s -analyze -basicaa -da-delinearize -da
;
; CHECK: da analyze - consistent input [S S]!
; CHECK: da analyze - confused!
; CHECK: da analyze - input [* *]!
;
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n8:16:32-S64"
target triple = "thumbv7--linux-gnueabi"
define void @f(i32** %a, i32 %n) align 2 {
for.preheader:
%t.0 = ashr exact i32 %n, 3
br label %for.body.1
for.body.1:
%i.1 = phi i32 [ %t.5, %for.inc ], [ 0, %for.preheader ]
%i.2 = phi i32 [ %i.5, %for.inc ], [ %t.0, %for.preheader ]
br i1 undef, label %for.inc, label %for.body.2
for.body.2:
%i.3 = phi i32 [ %t.1, %for.body.2 ], [ %i.1, %for.body.1 ]
%t.1 = add i32 %i.3, 1
%t.2 = load i32*, i32** %a, align 4
%t.3 = getelementptr inbounds i32, i32* %t.2, i32 %i.3
%t.4 = load i32, i32* %t.3, align 4
br i1 undef, label %for.inc, label %for.body.2
for.inc:
%i.4 = phi i32 [ %i.2, %for.body.1 ], [ %i.2, %for.body.2 ]
%t.5 = add i32 %i.1, %i.4
%i.5 = add i32 %i.2, -1
br i1 undef, label %for.exit, label %for.body.1
for.exit:
ret void
}

View File

@@ -0,0 +1,110 @@
; RUN: opt < %s -analyze -basicaa -da -da-delinearize=false | FileCheck %s
; RUN: opt < %s -analyze -basicaa -da -da-delinearize | FileCheck %s -check-prefix=DELIN
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.6.0"
; for (int i = 0; i < 100; ++i) {
; int t0 = a[i][i];
; int t1 = t0 + 1;
; a[i][5] = t1;
; }
; The subscript 5 in a[i][5] is deliberately an i32, mismatching the types of
; other subscript. DependenceAnalysis before the fix crashed due to this
; mismatch.
define void @i32_subscript([100 x [100 x i32]]* %a, i32* %b) {
; CHECK-LABEL: 'Dependence Analysis' for function 'i32_subscript'
; DELIN-LABEL: 'Dependence Analysis' for function 'i32_subscript'
entry:
br label %for.body
for.body:
; CHECK: da analyze - none!
; CHECK: da analyze - anti [=|<]!
; CHECK: da analyze - none!
; DELIN: da analyze - none!
; DELIN: da analyze - anti [=|<]!
; DELIN: da analyze - none!
%i = phi i64 [ 0, %entry ], [ %i.inc, %for.body ]
%a.addr = getelementptr [100 x [100 x i32]], [100 x [100 x i32]]* %a, i64 0, i64 %i, i64 %i
%a.addr.2 = getelementptr [100 x [100 x i32]], [100 x [100 x i32]]* %a, i64 0, i64 %i, i32 5
%0 = load i32, i32* %a.addr, align 4
%1 = add i32 %0, 1
store i32 %1, i32* %a.addr.2, align 4
%i.inc = add nsw i64 %i, 1
%exitcond = icmp ne i64 %i.inc, 100
br i1 %exitcond, label %for.body, label %for.end
for.end:
ret void
}
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
; unsigned i, j;
; for (i = 1; i < SIZE; i++) {
; for (j = i; j < SIZE; j++) {
; a[i][j] = a[i+1][j-1] + 2;
; }
; }
; Extends the previous example to coupled MIV subscripts.
@a = global [10004 x [10004 x i32]] zeroinitializer, align 16
; Function Attrs: nounwind uwtable
define void @coupled_miv_type_mismatch(i32 %n) #0 {
; CHECK-LABEL: 'Dependence Analysis' for function 'coupled_miv_type_mismatch'
; DELIN-LABEL: 'Dependence Analysis' for function 'coupled_miv_type_mismatch'
entry:
br label %for.cond
; CHECK: da analyze - input [0 *]!
; CHECK: da analyze - anti [1 *]!
; CHECK: da analyze - none!
; DELIN: da analyze - input [0 *]!
; DELIN: da analyze - anti [1 *]!
; DELIN: da analyze - none!
for.cond: ; preds = %for.inc11, %entry
%indvars.iv11 = phi i64 [ %indvars.iv.next12, %for.inc11 ], [ 1, %entry ]
%exitcond14 = icmp ne i64 %indvars.iv11, 10000
br i1 %exitcond14, label %for.cond1.preheader, label %for.end13
for.cond1.preheader: ; preds = %for.cond
%0 = trunc i64 %indvars.iv11 to i32
br label %for.cond1
for.cond1: ; preds = %for.cond1.preheader, %for.body3
%indvars.iv8 = phi i64 [ %indvars.iv11, %for.cond1.preheader ], [ %indvars.iv.next9, %for.body3 ]
%j.0 = phi i32 [ %inc, %for.body3 ], [ %0, %for.cond1.preheader ]
%lftr.wideiv = trunc i64 %indvars.iv8 to i32
%exitcond = icmp ne i32 %lftr.wideiv, 10000
br i1 %exitcond, label %for.body3, label %for.inc11
for.body3: ; preds = %for.cond1
%sub = add nsw i32 %j.0, -1
%idxprom = zext i32 %sub to i64
%1 = add nuw nsw i64 %indvars.iv11, 1
%arrayidx5 = getelementptr inbounds [10004 x [10004 x i32]], [10004 x [10004 x i32]]* @a, i64 0, i64 %1, i64 %idxprom
%2 = load i32, i32* %arrayidx5, align 4
%add6 = add nsw i32 %2, 2
%arrayidx10 = getelementptr inbounds [10004 x [10004 x i32]], [10004 x [10004 x i32]]* @a, i64 0, i64 %indvars.iv11, i64 %indvars.iv8
store i32 %add6, i32* %arrayidx10, align 4
%indvars.iv.next9 = add nuw nsw i64 %indvars.iv8, 1
%inc = add nuw nsw i32 %j.0, 1
br label %for.cond1
for.inc11: ; preds = %for.cond1
%indvars.iv.next12 = add nuw nsw i64 %indvars.iv11, 1
br label %for.cond
for.end13: ; preds = %for.cond
ret void
}
attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
!llvm.ident = !{!0}
!0 = !{!"clang version 3.7.0 (https://vaivaswatha@bitbucket.org/compilertree/amd_clang.git 93a05fb75ee3411d24e8b2b184fc766a5318403e) (https://vaivaswatha@bitbucket.org/compilertree/amd_llvm.git 166d93d26efc912b517739f64d054a435e8e95cd)"}

View File

@@ -0,0 +1,105 @@
; RUN: opt < %s -analyze -basicaa -globals-aa -da | FileCheck %s
define void @i32_subscript(i32* %a) {
entry:
br label %for.body
for.body:
%i = phi i32 [ 0, %entry ], [ %i.inc, %for.body ]
%a.addr = getelementptr i32, i32* %a, i32 %i
%a.addr.2 = getelementptr i32, i32* %a, i32 5
%0 = load i32, i32* %a.addr, align 4
%1 = add i32 %0, 1
store i32 %1, i32* %a.addr.2, align 4
%i.inc = add nsw i32 %i, 1
%i.inc.ext = sext i32 %i to i64
%exitcond = icmp ne i64 %i.inc.ext, 100
br i1 %exitcond, label %for.body, label %for.end
for.end:
ret void
}
; CHECK: none
; CHECK: anti
; CHECK: output
; Test for a bug, which caused an assert in ScalarEvolution because
; the Dependence Analyzer attempted to zero extend a type to a smaller
; type.
; void t(unsigned int *a, unsigned int n) {
; for (unsigned int i = 0; i != n; i++) {
; a[(unsigned short)i] = g;
; }}
@g = common global i32 0, align 4
define void @t(i32* noalias %a, i32 %n) nounwind {
entry:
%cmp1 = icmp eq i32 %n, 0
br i1 %cmp1, label %for.end, label %for.body
for.body:
%i.02 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%0 = load i32, i32* @g, align 4
%idxprom = and i32 %i.02, 65535
%arrayidx = getelementptr inbounds i32, i32* %a, i32 %idxprom
store i32 %0, i32* %arrayidx, align 4
%inc = add i32 %i.02, 1
%cmp = icmp eq i32 %inc, %n
br i1 %cmp, label %for.end, label %for.body
for.end:
ret void
}
; CHECK: input
; CHECK: none
; CHECK: output
define void @i16_wrap(i64* %a) {
entry:
br label %for.body
for.body:
%i = phi i64 [0, %entry], [%i.inc, %for.inc]
%i.tr = trunc i64 %i to i16
%idx = getelementptr i64, i64* %a, i16 %i.tr
%0 = load i64, i64* %idx
%1 = add i64 %0, 1
store i64 %1, i64* %idx
br label %for.inc
for.inc:
%i.inc = add nuw i64 %i, 1
%cmp = icmp ult i64 %i.inc, 17179869184
br i1 %cmp, label %for.body, label %for.end
for.end:
ret void
}
; CHECK: input
; CHECK: anti
; CHECK: output
define void @i8_stride_wrap(i32* noalias %a, i32* noalias %b) {
entry:
br label %for.body
for.body:
%i = phi i32 [1,%entry], [%i.inc, %for.inc]
%i.tr = trunc i32 %i to i8
%idx = getelementptr i32, i32* %a, i8 %i.tr
%idx.2 = getelementptr i32, i32* %b, i32 %i
%0 = load i32, i32* %idx, align 4
%1 = add i32 %0, 1
store i32 %1, i32* %idx.2, align 4
br label %for.inc
for.inc:
%i.inc = add nsw i32 %i, 256
%exitcond = icmp ult i32 %i, 65536
br i1 %exitcond, label %for.body, label %for.end
for.end:
ret void
}
; CHECK: input
; CHECK: none
; CHECK: none

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,303 @@
; RUN: opt < %s -analyze -basicaa -da | FileCheck %s
; ModuleID = 'Separability.bc'
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.6.0"
;; for (long int i = 0; i < 50; i++)
;; for (long int j = 0; j < 50; j++)
;; for (long int k = 0; k < 50; k++)
;; for (long int l = 0; l < 50; l++) {
;; A[n][i][j + k] = i;
;; *B++ = A[10][i + 10][2*j - l];
define void @sep0([100 x [100 x i32]]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
entry:
br label %for.cond1.preheader
; CHECK: da analyze - output [0 * * S]!
; CHECK: da analyze - flow [-10 * * *]!
; CHECK: da analyze - confused!
; CHECK: da analyze - input [0 * S *]!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
for.cond1.preheader: ; preds = %entry, %for.inc22
%B.addr.08 = phi i32* [ %B, %entry ], [ %scevgep11, %for.inc22 ]
%i.07 = phi i64 [ 0, %entry ], [ %inc23, %for.inc22 ]
br label %for.cond4.preheader
for.cond4.preheader: ; preds = %for.cond1.preheader, %for.inc19
%B.addr.16 = phi i32* [ %B.addr.08, %for.cond1.preheader ], [ %scevgep9, %for.inc19 ]
%j.05 = phi i64 [ 0, %for.cond1.preheader ], [ %inc20, %for.inc19 ]
br label %for.cond7.preheader
for.cond7.preheader: ; preds = %for.cond4.preheader, %for.inc16
%B.addr.24 = phi i32* [ %B.addr.16, %for.cond4.preheader ], [ %scevgep, %for.inc16 ]
%k.03 = phi i64 [ 0, %for.cond4.preheader ], [ %inc17, %for.inc16 ]
br label %for.body9
for.body9: ; preds = %for.cond7.preheader, %for.body9
%l.02 = phi i64 [ 0, %for.cond7.preheader ], [ %inc, %for.body9 ]
%B.addr.31 = phi i32* [ %B.addr.24, %for.cond7.preheader ], [ %incdec.ptr, %for.body9 ]
%conv = trunc i64 %i.07 to i32
%add = add nsw i64 %j.05, %k.03
%idxprom = sext i32 %n to i64
%arrayidx11 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %A, i64 %idxprom, i64 %i.07, i64 %add
store i32 %conv, i32* %arrayidx11, align 4
%mul = shl nsw i64 %j.05, 1
%sub = sub nsw i64 %mul, %l.02
%add12 = add nsw i64 %i.07, 10
%arrayidx15 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %A, i64 10, i64 %add12, i64 %sub
%0 = load i32, i32* %arrayidx15, align 4
%incdec.ptr = getelementptr inbounds i32, i32* %B.addr.31, i64 1
store i32 %0, i32* %B.addr.31, align 4
%inc = add nsw i64 %l.02, 1
%exitcond = icmp ne i64 %inc, 50
br i1 %exitcond, label %for.body9, label %for.inc16
for.inc16: ; preds = %for.body9
%scevgep = getelementptr i32, i32* %B.addr.24, i64 50
%inc17 = add nsw i64 %k.03, 1
%exitcond10 = icmp ne i64 %inc17, 50
br i1 %exitcond10, label %for.cond7.preheader, label %for.inc19
for.inc19: ; preds = %for.inc16
%scevgep9 = getelementptr i32, i32* %B.addr.16, i64 2500
%inc20 = add nsw i64 %j.05, 1
%exitcond12 = icmp ne i64 %inc20, 50
br i1 %exitcond12, label %for.cond4.preheader, label %for.inc22
for.inc22: ; preds = %for.inc19
%scevgep11 = getelementptr i32, i32* %B.addr.08, i64 125000
%inc23 = add nsw i64 %i.07, 1
%exitcond13 = icmp ne i64 %inc23, 50
br i1 %exitcond13, label %for.cond1.preheader, label %for.end24
for.end24: ; preds = %for.inc22
ret void
}
;; for (long int i = 0; i < 50; i++)
;; for (long int j = 0; j < 50; j++)
;; for (long int k = 0; k < 50; k++)
;; for (long int l = 0; l < 50; l++) {
;; A[i][i][j + k] = i;
;; *B++ = A[10][i + 10][2*j - l];
define void @sep1([100 x [100 x i32]]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
entry:
br label %for.cond1.preheader
; CHECK: da analyze - output [0 * * S]!
; CHECK: da analyze - flow [> * * *]!
; CHECK: da analyze - confused!
; CHECK: da analyze - input [0 * S *]!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
for.cond1.preheader: ; preds = %entry, %for.inc22
%B.addr.08 = phi i32* [ %B, %entry ], [ %scevgep11, %for.inc22 ]
%i.07 = phi i64 [ 0, %entry ], [ %inc23, %for.inc22 ]
br label %for.cond4.preheader
for.cond4.preheader: ; preds = %for.cond1.preheader, %for.inc19
%B.addr.16 = phi i32* [ %B.addr.08, %for.cond1.preheader ], [ %scevgep9, %for.inc19 ]
%j.05 = phi i64 [ 0, %for.cond1.preheader ], [ %inc20, %for.inc19 ]
br label %for.cond7.preheader
for.cond7.preheader: ; preds = %for.cond4.preheader, %for.inc16
%B.addr.24 = phi i32* [ %B.addr.16, %for.cond4.preheader ], [ %scevgep, %for.inc16 ]
%k.03 = phi i64 [ 0, %for.cond4.preheader ], [ %inc17, %for.inc16 ]
br label %for.body9
for.body9: ; preds = %for.cond7.preheader, %for.body9
%l.02 = phi i64 [ 0, %for.cond7.preheader ], [ %inc, %for.body9 ]
%B.addr.31 = phi i32* [ %B.addr.24, %for.cond7.preheader ], [ %incdec.ptr, %for.body9 ]
%conv = trunc i64 %i.07 to i32
%add = add nsw i64 %j.05, %k.03
%arrayidx11 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %A, i64 %i.07, i64 %i.07, i64 %add
store i32 %conv, i32* %arrayidx11, align 4
%mul = shl nsw i64 %j.05, 1
%sub = sub nsw i64 %mul, %l.02
%add12 = add nsw i64 %i.07, 10
%arrayidx15 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %A, i64 10, i64 %add12, i64 %sub
%0 = load i32, i32* %arrayidx15, align 4
%incdec.ptr = getelementptr inbounds i32, i32* %B.addr.31, i64 1
store i32 %0, i32* %B.addr.31, align 4
%inc = add nsw i64 %l.02, 1
%exitcond = icmp ne i64 %inc, 50
br i1 %exitcond, label %for.body9, label %for.inc16
for.inc16: ; preds = %for.body9
%scevgep = getelementptr i32, i32* %B.addr.24, i64 50
%inc17 = add nsw i64 %k.03, 1
%exitcond10 = icmp ne i64 %inc17, 50
br i1 %exitcond10, label %for.cond7.preheader, label %for.inc19
for.inc19: ; preds = %for.inc16
%scevgep9 = getelementptr i32, i32* %B.addr.16, i64 2500
%inc20 = add nsw i64 %j.05, 1
%exitcond12 = icmp ne i64 %inc20, 50
br i1 %exitcond12, label %for.cond4.preheader, label %for.inc22
for.inc22: ; preds = %for.inc19
%scevgep11 = getelementptr i32, i32* %B.addr.08, i64 125000
%inc23 = add nsw i64 %i.07, 1
%exitcond13 = icmp ne i64 %inc23, 50
br i1 %exitcond13, label %for.cond1.preheader, label %for.end24
for.end24: ; preds = %for.inc22
ret void
}
;; for (long int i = 0; i < 50; i++)
;; for (long int j = 0; j < 50; j++)
;; for (long int k = 0; k < 50; k++)
;; for (long int l = 0; l < 50; l++) {
;; A[i][i][i + k][l] = i;
;; *B++ = A[10][i + 10][j + k][l + 10];
define void @sep2([100 x [100 x [100 x i32]]]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
entry:
br label %for.cond1.preheader
; CHECK: da analyze - consistent output [0 S 0 0]!
; CHECK: da analyze - flow [> * * -10]!
; CHECK: da analyze - confused!
; CHECK: da analyze - input [0 * * 0]!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
for.cond1.preheader: ; preds = %entry, %for.inc26
%B.addr.08 = phi i32* [ %B, %entry ], [ %scevgep11, %for.inc26 ]
%i.07 = phi i64 [ 0, %entry ], [ %inc27, %for.inc26 ]
br label %for.cond4.preheader
for.cond4.preheader: ; preds = %for.cond1.preheader, %for.inc23
%B.addr.16 = phi i32* [ %B.addr.08, %for.cond1.preheader ], [ %scevgep9, %for.inc23 ]
%j.05 = phi i64 [ 0, %for.cond1.preheader ], [ %inc24, %for.inc23 ]
br label %for.cond7.preheader
for.cond7.preheader: ; preds = %for.cond4.preheader, %for.inc20
%B.addr.24 = phi i32* [ %B.addr.16, %for.cond4.preheader ], [ %scevgep, %for.inc20 ]
%k.03 = phi i64 [ 0, %for.cond4.preheader ], [ %inc21, %for.inc20 ]
br label %for.body9
for.body9: ; preds = %for.cond7.preheader, %for.body9
%l.02 = phi i64 [ 0, %for.cond7.preheader ], [ %inc, %for.body9 ]
%B.addr.31 = phi i32* [ %B.addr.24, %for.cond7.preheader ], [ %incdec.ptr, %for.body9 ]
%conv = trunc i64 %i.07 to i32
%add = add nsw i64 %i.07, %k.03
%arrayidx12 = getelementptr inbounds [100 x [100 x [100 x i32]]], [100 x [100 x [100 x i32]]]* %A, i64 %i.07, i64 %i.07, i64 %add, i64 %l.02
store i32 %conv, i32* %arrayidx12, align 4
%add13 = add nsw i64 %l.02, 10
%add14 = add nsw i64 %j.05, %k.03
%add15 = add nsw i64 %i.07, 10
%arrayidx19 = getelementptr inbounds [100 x [100 x [100 x i32]]], [100 x [100 x [100 x i32]]]* %A, i64 10, i64 %add15, i64 %add14, i64 %add13
%0 = load i32, i32* %arrayidx19, align 4
%incdec.ptr = getelementptr inbounds i32, i32* %B.addr.31, i64 1
store i32 %0, i32* %B.addr.31, align 4
%inc = add nsw i64 %l.02, 1
%exitcond = icmp ne i64 %inc, 50
br i1 %exitcond, label %for.body9, label %for.inc20
for.inc20: ; preds = %for.body9
%scevgep = getelementptr i32, i32* %B.addr.24, i64 50
%inc21 = add nsw i64 %k.03, 1
%exitcond10 = icmp ne i64 %inc21, 50
br i1 %exitcond10, label %for.cond7.preheader, label %for.inc23
for.inc23: ; preds = %for.inc20
%scevgep9 = getelementptr i32, i32* %B.addr.16, i64 2500
%inc24 = add nsw i64 %j.05, 1
%exitcond12 = icmp ne i64 %inc24, 50
br i1 %exitcond12, label %for.cond4.preheader, label %for.inc26
for.inc26: ; preds = %for.inc23
%scevgep11 = getelementptr i32, i32* %B.addr.08, i64 125000
%inc27 = add nsw i64 %i.07, 1
%exitcond13 = icmp ne i64 %inc27, 50
br i1 %exitcond13, label %for.cond1.preheader, label %for.end28
for.end28: ; preds = %for.inc26
ret void
}
;; for (long int i = 0; i < 50; i++)
;; for (long int j = 0; j < 50; j++)
;; for (long int k = 0; k < 50; k++)
;; for (long int l = 0; l < 50; l++) {
;; A[i][i][i + k][l + k] = i;
;; *B++ = A[10][i + 10][j + k][l + 10];
define void @sep3([100 x [100 x [100 x i32]]]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
entry:
br label %for.cond1.preheader
; CHECK: da analyze - consistent output [0 S 0 0]!
; CHECK: da analyze - flow [> * * *]!
; CHECK: da analyze - confused!
; CHECK: da analyze - input [0 * * 0]!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
for.cond1.preheader: ; preds = %entry, %for.inc27
%B.addr.08 = phi i32* [ %B, %entry ], [ %scevgep11, %for.inc27 ]
%i.07 = phi i64 [ 0, %entry ], [ %inc28, %for.inc27 ]
br label %for.cond4.preheader
for.cond4.preheader: ; preds = %for.cond1.preheader, %for.inc24
%B.addr.16 = phi i32* [ %B.addr.08, %for.cond1.preheader ], [ %scevgep9, %for.inc24 ]
%j.05 = phi i64 [ 0, %for.cond1.preheader ], [ %inc25, %for.inc24 ]
br label %for.cond7.preheader
for.cond7.preheader: ; preds = %for.cond4.preheader, %for.inc21
%B.addr.24 = phi i32* [ %B.addr.16, %for.cond4.preheader ], [ %scevgep, %for.inc21 ]
%k.03 = phi i64 [ 0, %for.cond4.preheader ], [ %inc22, %for.inc21 ]
br label %for.body9
for.body9: ; preds = %for.cond7.preheader, %for.body9
%l.02 = phi i64 [ 0, %for.cond7.preheader ], [ %inc, %for.body9 ]
%B.addr.31 = phi i32* [ %B.addr.24, %for.cond7.preheader ], [ %incdec.ptr, %for.body9 ]
%conv = trunc i64 %i.07 to i32
%add = add nsw i64 %l.02, %k.03
%add10 = add nsw i64 %i.07, %k.03
%arrayidx13 = getelementptr inbounds [100 x [100 x [100 x i32]]], [100 x [100 x [100 x i32]]]* %A, i64 %i.07, i64 %i.07, i64 %add10, i64 %add
store i32 %conv, i32* %arrayidx13, align 4
%add14 = add nsw i64 %l.02, 10
%add15 = add nsw i64 %j.05, %k.03
%add16 = add nsw i64 %i.07, 10
%arrayidx20 = getelementptr inbounds [100 x [100 x [100 x i32]]], [100 x [100 x [100 x i32]]]* %A, i64 10, i64 %add16, i64 %add15, i64 %add14
%0 = load i32, i32* %arrayidx20, align 4
%incdec.ptr = getelementptr inbounds i32, i32* %B.addr.31, i64 1
store i32 %0, i32* %B.addr.31, align 4
%inc = add nsw i64 %l.02, 1
%exitcond = icmp ne i64 %inc, 50
br i1 %exitcond, label %for.body9, label %for.inc21
for.inc21: ; preds = %for.body9
%scevgep = getelementptr i32, i32* %B.addr.24, i64 50
%inc22 = add nsw i64 %k.03, 1
%exitcond10 = icmp ne i64 %inc22, 50
br i1 %exitcond10, label %for.cond7.preheader, label %for.inc24
for.inc24: ; preds = %for.inc21
%scevgep9 = getelementptr i32, i32* %B.addr.16, i64 2500
%inc25 = add nsw i64 %j.05, 1
%exitcond12 = icmp ne i64 %inc25, 50
br i1 %exitcond12, label %for.cond4.preheader, label %for.inc27
for.inc27: ; preds = %for.inc24
%scevgep11 = getelementptr i32, i32* %B.addr.08, i64 125000
%inc28 = add nsw i64 %i.07, 1
%exitcond13 = icmp ne i64 %inc28, 50
br i1 %exitcond13, label %for.cond1.preheader, label %for.end29
for.end29: ; preds = %for.inc27
ret void
}

View File

@@ -0,0 +1,436 @@
; RUN: opt < %s -analyze -basicaa -da | FileCheck %s
; ModuleID = 'StrongSIV.bc'
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.6.0"
;; for (int i = 0; i < n; i++) {
;; A[i + 2] = i;
;; *B++ = A[i];
define void @strong0(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
%cmp1 = icmp sgt i64 %n, 0
br i1 %cmp1, label %for.body.preheader, label %for.end
; CHECK: da analyze - none!
; CHECK: da analyze - consistent flow [2]!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
for.body.preheader: ; preds = %entry
br label %for.body
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
%0 = add nsw i64 %indvars.iv, 2
%arrayidx = getelementptr inbounds i32, i32* %A, i64 %0
%1 = trunc i64 %indvars.iv to i32
store i32 %1, i32* %arrayidx, align 4
%arrayidx3 = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
%2 = load i32, i32* %arrayidx3, align 4
%incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
store i32 %2, i32* %B.addr.02, align 4
%indvars.iv.next = add i64 %indvars.iv, 1
%exitcond = icmp ne i64 %indvars.iv.next, %n
br i1 %exitcond, label %for.body, label %for.end.loopexit
for.end.loopexit: ; preds = %for.body
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
ret void
}
;; for (long int i = 0; i < n; i++) {
;; A[i + 2] = i;
;; *B++ = A[i];
define void @strong1(i32* %A, i32* %B, i32 %n) nounwind uwtable ssp {
entry:
%cmp1 = icmp sgt i32 %n, 0
br i1 %cmp1, label %for.body.preheader, label %for.end
; CHECK: da analyze - none!
; CHECK: da analyze - consistent flow [2]!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
for.body.preheader: ; preds = %entry
%0 = sext i32 %n to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %for.body
%i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
%B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
%conv2 = trunc i64 %i.03 to i32
%add = add nsw i64 %i.03, 2
%arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
store i32 %conv2, i32* %arrayidx, align 4
%arrayidx3 = getelementptr inbounds i32, i32* %A, i64 %i.03
%1 = load i32, i32* %arrayidx3, align 4
%incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
store i32 %1, i32* %B.addr.02, align 4
%inc = add nsw i64 %i.03, 1
%exitcond = icmp ne i64 %inc, %0
br i1 %exitcond, label %for.body, label %for.end.loopexit
for.end.loopexit: ; preds = %for.body
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
ret void
}
;; for (long unsigned i = 0; i < n; i++) {
;; A[i + 2] = i;
;; *B++ = A[i];
define void @strong2(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
%cmp1 = icmp eq i64 %n, 0
br i1 %cmp1, label %for.end, label %for.body.preheader
; CHECK: da analyze - none!
; CHECK: da analyze - consistent flow [2]!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
for.body.preheader: ; preds = %entry
br label %for.body
for.body: ; preds = %for.body.preheader, %for.body
%i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
%B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
%conv = trunc i64 %i.03 to i32
%add = add i64 %i.03, 2
%arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
store i32 %conv, i32* %arrayidx, align 4
%arrayidx1 = getelementptr inbounds i32, i32* %A, i64 %i.03
%0 = load i32, i32* %arrayidx1, align 4
%incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
store i32 %0, i32* %B.addr.02, align 4
%inc = add i64 %i.03, 1
%exitcond = icmp ne i64 %inc, %n
br i1 %exitcond, label %for.body, label %for.end.loopexit
for.end.loopexit: ; preds = %for.body
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
ret void
}
;; for (int i = 0; i < n; i++) {
;; A[i + 2] = i;
;; *B++ = A[i];
define void @strong3(i32* %A, i32* %B, i32 %n) nounwind uwtable ssp {
entry:
%cmp1 = icmp sgt i32 %n, 0
br i1 %cmp1, label %for.body.preheader, label %for.end
; CHECK: da analyze - none!
; CHECK: da analyze - consistent flow [2]!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
for.body.preheader: ; preds = %entry
br label %for.body
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
%0 = add nsw i64 %indvars.iv, 2
%arrayidx = getelementptr inbounds i32, i32* %A, i64 %0
%1 = trunc i64 %indvars.iv to i32
store i32 %1, i32* %arrayidx, align 4
%arrayidx2 = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
%2 = load i32, i32* %arrayidx2, align 4
%incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
store i32 %2, i32* %B.addr.02, align 4
%indvars.iv.next = add i64 %indvars.iv, 1
%lftr.wideiv = trunc i64 %indvars.iv.next to i32
%exitcond = icmp ne i32 %lftr.wideiv, %n
br i1 %exitcond, label %for.body, label %for.end.loopexit
for.end.loopexit: ; preds = %for.body
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
ret void
}
;; for (long unsigned i = 0; i < 19; i++) {
;; A[i + 19] = i;
;; *B++ = A[i];
define void @strong4(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
br label %for.body
; CHECK: da analyze - none!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
%add = add i64 %i.02, 19
%arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
store i32 %conv, i32* %arrayidx, align 4
%arrayidx1 = getelementptr inbounds i32, i32* %A, i64 %i.02
%0 = load i32, i32* %arrayidx1, align 4
%incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add i64 %i.02, 1
%exitcond = icmp ne i64 %inc, 19
br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
}
;; for (long unsigned i = 0; i < 20; i++) {
;; A[i + 19] = i;
;; *B++ = A[i];
define void @strong5(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
br label %for.body
; CHECK: da analyze - none!
; CHECK: da analyze - consistent flow [19]!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
%add = add i64 %i.02, 19
%arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
store i32 %conv, i32* %arrayidx, align 4
%arrayidx1 = getelementptr inbounds i32, i32* %A, i64 %i.02
%0 = load i32, i32* %arrayidx1, align 4
%incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add i64 %i.02, 1
%exitcond = icmp ne i64 %inc, 20
br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
}
;; for (long unsigned i = 0; i < 20; i++) {
;; A[2*i + 6] = i;
;; *B++ = A[2*i];
define void @strong6(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
br label %for.body
; CHECK: da analyze - none!
; CHECK: da analyze - consistent flow [3]!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
%mul = shl i64 %i.02, 1
%add = add i64 %mul, 6
%arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
store i32 %conv, i32* %arrayidx, align 4
%mul1 = shl i64 %i.02, 1
%arrayidx2 = getelementptr inbounds i32, i32* %A, i64 %mul1
%0 = load i32, i32* %arrayidx2, align 4
%incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add i64 %i.02, 1
%exitcond = icmp ne i64 %inc, 20
br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
}
;; for (long unsigned i = 0; i < 20; i++) {
;; A[2*i + 7] = i;
;; *B++ = A[2*i];
define void @strong7(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
br label %for.body
; CHECK: da analyze - none!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
%mul = shl i64 %i.02, 1
%add = add i64 %mul, 7
%arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
store i32 %conv, i32* %arrayidx, align 4
%mul1 = shl i64 %i.02, 1
%arrayidx2 = getelementptr inbounds i32, i32* %A, i64 %mul1
%0 = load i32, i32* %arrayidx2, align 4
%incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add i64 %i.02, 1
%exitcond = icmp ne i64 %inc, 20
br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
}
;; for (long unsigned i = 0; i < 20; i++) {
;; A[i + n] = i;
;; *B++ = A[i];
define void @strong8(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
br label %for.body
; CHECK: da analyze - none!
; CHECK: da analyze - consistent flow [%n|<]!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
%add = add i64 %i.02, %n
%arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
store i32 %conv, i32* %arrayidx, align 4
%arrayidx1 = getelementptr inbounds i32, i32* %A, i64 %i.02
%0 = load i32, i32* %arrayidx1, align 4
%incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add i64 %i.02, 1
%exitcond = icmp ne i64 %inc, 20
br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
}
;; for (long unsigned i = 0; i < n; i++) {
;; A[i + n] = i;
;; *B++ = A[i + 2*n];
define void @strong9(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
%cmp1 = icmp eq i64 %n, 0
br i1 %cmp1, label %for.end, label %for.body.preheader
; CHECK: da analyze - none!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
for.body.preheader: ; preds = %entry
br label %for.body
for.body: ; preds = %for.body.preheader, %for.body
%i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
%B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
%conv = trunc i64 %i.03 to i32
%add = add i64 %i.03, %n
%arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
store i32 %conv, i32* %arrayidx, align 4
%mul = shl i64 %n, 1
%add1 = add i64 %i.03, %mul
%arrayidx2 = getelementptr inbounds i32, i32* %A, i64 %add1
%0 = load i32, i32* %arrayidx2, align 4
%incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
store i32 %0, i32* %B.addr.02, align 4
%inc = add i64 %i.03, 1
%exitcond = icmp ne i64 %inc, %n
br i1 %exitcond, label %for.body, label %for.end.loopexit
for.end.loopexit: ; preds = %for.body
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
ret void
}
;; for (long unsigned i = 0; i < 1000; i++) {
;; A[n*i + 5] = i;
;; *B++ = A[n*i + 5];
define void @strong10(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
br label %for.body
; CHECK: da analyze - none!
; CHECK: da analyze - consistent flow [0|<]!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
%mul = mul i64 %i.02, %n
%add = add i64 %mul, 5
%arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
store i32 %conv, i32* %arrayidx, align 4
%mul1 = mul i64 %i.02, %n
%add2 = add i64 %mul1, 5
%arrayidx3 = getelementptr inbounds i32, i32* %A, i64 %add2
%0 = load i32, i32* %arrayidx3, align 4
%incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add i64 %i.02, 1
%exitcond = icmp ne i64 %inc, 1000
br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
}

View File

@@ -0,0 +1,446 @@
; RUN: opt < %s -analyze -basicaa -da | FileCheck %s
; ModuleID = 'SymbolicRDIV.bc'
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.6.0"
;; for (long int i = 0; i < n1; i++)
;; A[2*i + n1] = i;
;; for (long int j = 0; j < n2; j++)
;; *B++ = A[3*j + 3*n1];
define void @symbolicrdiv0(i32* %A, i32* %B, i64 %n1, i64 %n2) nounwind uwtable ssp {
entry:
%cmp4 = icmp eq i64 %n1, 0
br i1 %cmp4, label %for.cond1.preheader, label %for.body.preheader
; CHECK: 'Dependence Analysis' for function 'symbolicrdiv0'
; CHECK: da analyze - none!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
for.body.preheader: ; preds = %entry
br label %for.body
for.cond1.preheader.loopexit: ; preds = %for.body
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.loopexit, %entry
%cmp21 = icmp eq i64 %n2, 0
br i1 %cmp21, label %for.end11, label %for.body4.preheader
for.body4.preheader: ; preds = %for.cond1.preheader
br label %for.body4
for.body: ; preds = %for.body.preheader, %for.body
%i.05 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
%conv = trunc i64 %i.05 to i32
%mul = shl nsw i64 %i.05, 1
%add = add i64 %mul, %n1
%arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
store i32 %conv, i32* %arrayidx, align 4
%inc = add nsw i64 %i.05, 1
%exitcond = icmp ne i64 %inc, %n1
br i1 %exitcond, label %for.body, label %for.cond1.preheader.loopexit
for.body4: ; preds = %for.body4.preheader, %for.body4
%j.03 = phi i64 [ %inc10, %for.body4 ], [ 0, %for.body4.preheader ]
%B.addr.02 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body4.preheader ]
%mul56 = add i64 %j.03, %n1
%add7 = mul i64 %mul56, 3
%arrayidx8 = getelementptr inbounds i32, i32* %A, i64 %add7
%0 = load i32, i32* %arrayidx8, align 4
%incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
store i32 %0, i32* %B.addr.02, align 4
%inc10 = add nsw i64 %j.03, 1
%exitcond7 = icmp ne i64 %inc10, %n2
br i1 %exitcond7, label %for.body4, label %for.end11.loopexit
for.end11.loopexit: ; preds = %for.body4
br label %for.end11
for.end11: ; preds = %for.end11.loopexit, %for.cond1.preheader
ret void
}
;; for (long int i = 0; i < n1; i++)
;; A[2*i + 5*n2] = i;
;; for (long int j = 0; j < n2; j++)
;; *B++ = A[3*j + 2*n2];
define void @symbolicrdiv1(i32* %A, i32* %B, i64 %n1, i64 %n2) nounwind uwtable ssp {
entry:
%cmp4 = icmp eq i64 %n1, 0
br i1 %cmp4, label %for.cond2.preheader, label %for.body.preheader
; CHECK: 'Dependence Analysis' for function 'symbolicrdiv1'
; CHECK: da analyze - none!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
for.body.preheader: ; preds = %entry
br label %for.body
for.cond2.preheader.loopexit: ; preds = %for.body
br label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.cond2.preheader.loopexit, %entry
%cmp31 = icmp eq i64 %n2, 0
br i1 %cmp31, label %for.end12, label %for.body5.preheader
for.body5.preheader: ; preds = %for.cond2.preheader
br label %for.body5
for.body: ; preds = %for.body.preheader, %for.body
%i.05 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
%conv = trunc i64 %i.05 to i32
%mul = shl nsw i64 %i.05, 1
%mul1 = mul i64 %n2, 5
%add = add i64 %mul, %mul1
%arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
store i32 %conv, i32* %arrayidx, align 4
%inc = add nsw i64 %i.05, 1
%exitcond = icmp ne i64 %inc, %n1
br i1 %exitcond, label %for.body, label %for.cond2.preheader.loopexit
for.body5: ; preds = %for.body5.preheader, %for.body5
%j.03 = phi i64 [ %inc11, %for.body5 ], [ 0, %for.body5.preheader ]
%B.addr.02 = phi i32* [ %incdec.ptr, %for.body5 ], [ %B, %for.body5.preheader ]
%mul6 = mul nsw i64 %j.03, 3
%mul7 = shl i64 %n2, 1
%add8 = add i64 %mul6, %mul7
%arrayidx9 = getelementptr inbounds i32, i32* %A, i64 %add8
%0 = load i32, i32* %arrayidx9, align 4
%incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
store i32 %0, i32* %B.addr.02, align 4
%inc11 = add nsw i64 %j.03, 1
%exitcond6 = icmp ne i64 %inc11, %n2
br i1 %exitcond6, label %for.body5, label %for.end12.loopexit
for.end12.loopexit: ; preds = %for.body5
br label %for.end12
for.end12: ; preds = %for.end12.loopexit, %for.cond2.preheader
ret void
}
;; for (long int i = 0; i < n1; i++)
;; A[2*i - n2] = i;
;; for (long int j = 0; j < n2; j++)
;; *B++ = A[-j + 2*n1];
define void @symbolicrdiv2(i32* %A, i32* %B, i64 %n1, i64 %n2) nounwind uwtable ssp {
entry:
%cmp4 = icmp eq i64 %n1, 0
br i1 %cmp4, label %for.cond1.preheader, label %for.body.preheader
; CHECK: 'Dependence Analysis' for function 'symbolicrdiv2'
; CHECK: da analyze - none!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
for.body.preheader: ; preds = %entry
br label %for.body
for.cond1.preheader.loopexit: ; preds = %for.body
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.loopexit, %entry
%cmp21 = icmp eq i64 %n2, 0
br i1 %cmp21, label %for.end10, label %for.body4.preheader
for.body4.preheader: ; preds = %for.cond1.preheader
br label %for.body4
for.body: ; preds = %for.body.preheader, %for.body
%i.05 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
%conv = trunc i64 %i.05 to i32
%mul = shl nsw i64 %i.05, 1
%sub = sub i64 %mul, %n2
%arrayidx = getelementptr inbounds i32, i32* %A, i64 %sub
store i32 %conv, i32* %arrayidx, align 4
%inc = add nsw i64 %i.05, 1
%exitcond = icmp ne i64 %inc, %n1
br i1 %exitcond, label %for.body, label %for.cond1.preheader.loopexit
for.body4: ; preds = %for.body4.preheader, %for.body4
%j.03 = phi i64 [ %inc9, %for.body4 ], [ 0, %for.body4.preheader ]
%B.addr.02 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body4.preheader ]
%mul6 = shl i64 %n1, 1
%add = sub i64 %mul6, %j.03
%arrayidx7 = getelementptr inbounds i32, i32* %A, i64 %add
%0 = load i32, i32* %arrayidx7, align 4
%incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
store i32 %0, i32* %B.addr.02, align 4
%inc9 = add nsw i64 %j.03, 1
%exitcond6 = icmp ne i64 %inc9, %n2
br i1 %exitcond6, label %for.body4, label %for.end10.loopexit
for.end10.loopexit: ; preds = %for.body4
br label %for.end10
for.end10: ; preds = %for.end10.loopexit, %for.cond1.preheader
ret void
}
;; for (long int i = 0; i < n1; i++)
;; A[-i + n2] = i;
;; for (long int j = 0; j < n2; j++)
;; *B++ = A[j - n1];
define void @symbolicrdiv3(i32* %A, i32* %B, i64 %n1, i64 %n2) nounwind uwtable ssp {
entry:
%cmp4 = icmp eq i64 %n1, 0
br i1 %cmp4, label %for.cond1.preheader, label %for.body.preheader
; CHECK: 'Dependence Analysis' for function 'symbolicrdiv3'
; CHECK: da analyze - none!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
for.body.preheader: ; preds = %entry
br label %for.body
for.cond1.preheader.loopexit: ; preds = %for.body
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.loopexit, %entry
%cmp21 = icmp eq i64 %n2, 0
br i1 %cmp21, label %for.end9, label %for.body4.preheader
for.body4.preheader: ; preds = %for.cond1.preheader
br label %for.body4
for.body: ; preds = %for.body.preheader, %for.body
%i.05 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
%conv = trunc i64 %i.05 to i32
%add = sub i64 %n2, %i.05
%arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
store i32 %conv, i32* %arrayidx, align 4
%inc = add nsw i64 %i.05, 1
%exitcond = icmp ne i64 %inc, %n1
br i1 %exitcond, label %for.body, label %for.cond1.preheader.loopexit
for.body4: ; preds = %for.body4.preheader, %for.body4
%j.03 = phi i64 [ %inc8, %for.body4 ], [ 0, %for.body4.preheader ]
%B.addr.02 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body4.preheader ]
%sub5 = sub i64 %j.03, %n1
%arrayidx6 = getelementptr inbounds i32, i32* %A, i64 %sub5
%0 = load i32, i32* %arrayidx6, align 4
%incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
store i32 %0, i32* %B.addr.02, align 4
%inc8 = add nsw i64 %j.03, 1
%exitcond6 = icmp ne i64 %inc8, %n2
br i1 %exitcond6, label %for.body4, label %for.end9.loopexit
for.end9.loopexit: ; preds = %for.body4
br label %for.end9
for.end9: ; preds = %for.end9.loopexit, %for.cond1.preheader
ret void
}
;; for (long int i = 0; i < n1; i++)
;; A[-i + 2*n1] = i;
;; for (long int j = 0; j < n2; j++)
;; *B++ = A[-j + n1];
define void @symbolicrdiv4(i32* %A, i32* %B, i64 %n1, i64 %n2) nounwind uwtable ssp {
entry:
%cmp4 = icmp eq i64 %n1, 0
br i1 %cmp4, label %for.cond1.preheader, label %for.body.preheader
; CHECK: 'Dependence Analysis' for function 'symbolicrdiv4'
; CHECK: da analyze - none!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
for.body.preheader: ; preds = %entry
br label %for.body
for.cond1.preheader.loopexit: ; preds = %for.body
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.loopexit, %entry
%cmp21 = icmp eq i64 %n2, 0
br i1 %cmp21, label %for.end10, label %for.body4.preheader
for.body4.preheader: ; preds = %for.cond1.preheader
br label %for.body4
for.body: ; preds = %for.body.preheader, %for.body
%i.05 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
%conv = trunc i64 %i.05 to i32
%mul = shl i64 %n1, 1
%add = sub i64 %mul, %i.05
%arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
store i32 %conv, i32* %arrayidx, align 4
%inc = add nsw i64 %i.05, 1
%exitcond = icmp ne i64 %inc, %n1
br i1 %exitcond, label %for.body, label %for.cond1.preheader.loopexit
for.body4: ; preds = %for.body4.preheader, %for.body4
%j.03 = phi i64 [ %inc9, %for.body4 ], [ 0, %for.body4.preheader ]
%B.addr.02 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body4.preheader ]
%add6 = sub i64 %n1, %j.03
%arrayidx7 = getelementptr inbounds i32, i32* %A, i64 %add6
%0 = load i32, i32* %arrayidx7, align 4
%incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
store i32 %0, i32* %B.addr.02, align 4
%inc9 = add nsw i64 %j.03, 1
%exitcond6 = icmp ne i64 %inc9, %n2
br i1 %exitcond6, label %for.body4, label %for.end10.loopexit
for.end10.loopexit: ; preds = %for.body4
br label %for.end10
for.end10: ; preds = %for.end10.loopexit, %for.cond1.preheader
ret void
}
;; for (long int i = 0; i < n1; i++)
;; A[-i + n2] = i;
;; for (long int j = 0; j < n2; j++)
;; *B++ = A[-j + 2*n2];
define void @symbolicrdiv5(i32* %A, i32* %B, i64 %n1, i64 %n2) nounwind uwtable ssp {
entry:
%cmp4 = icmp eq i64 %n1, 0
br i1 %cmp4, label %for.cond1.preheader, label %for.body.preheader
; CHECK: 'Dependence Analysis' for function 'symbolicrdiv5'
; CHECK: da analyze - none!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
for.body.preheader: ; preds = %entry
br label %for.body
for.cond1.preheader.loopexit: ; preds = %for.body
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.loopexit, %entry
%cmp21 = icmp eq i64 %n2, 0
br i1 %cmp21, label %for.end10, label %for.body4.preheader
for.body4.preheader: ; preds = %for.cond1.preheader
br label %for.body4
for.body: ; preds = %for.body.preheader, %for.body
%i.05 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
%conv = trunc i64 %i.05 to i32
%add = sub i64 %n2, %i.05
%arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
store i32 %conv, i32* %arrayidx, align 4
%inc = add nsw i64 %i.05, 1
%exitcond = icmp ne i64 %inc, %n1
br i1 %exitcond, label %for.body, label %for.cond1.preheader.loopexit
for.body4: ; preds = %for.body4.preheader, %for.body4
%j.03 = phi i64 [ %inc9, %for.body4 ], [ 0, %for.body4.preheader ]
%B.addr.02 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body4.preheader ]
%mul = shl i64 %n2, 1
%add6 = sub i64 %mul, %j.03
%arrayidx7 = getelementptr inbounds i32, i32* %A, i64 %add6
%0 = load i32, i32* %arrayidx7, align 4
%incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
store i32 %0, i32* %B.addr.02, align 4
%inc9 = add nsw i64 %j.03, 1
%exitcond6 = icmp ne i64 %inc9, %n2
br i1 %exitcond6, label %for.body4, label %for.end10.loopexit
for.end10.loopexit: ; preds = %for.body4
br label %for.end10
for.end10: ; preds = %for.end10.loopexit, %for.cond1.preheader
ret void
}
;; for (long int i = 0; i < n1; i++)
;; for (long int j = 0; j < n2; j++) {
;; A[j -i + n2] = i;
;; *B++ = A[2*n2];
define void @symbolicrdiv6(i32* %A, i32* %B, i64 %n1, i64 %n2) nounwind uwtable ssp {
entry:
%cmp4 = icmp eq i64 %n1, 0
br i1 %cmp4, label %for.end7, label %for.cond1.preheader.preheader
; CHECK: 'Dependence Analysis' for function 'symbolicrdiv6'
; CHECK: da analyze - output [* *]!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - consistent input [S S]!
; CHECK: da analyze - confused!
; CHECK: da analyze - output [* *]!
for.cond1.preheader.preheader: ; preds = %entry
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.inc5
%B.addr.06 = phi i32* [ %B.addr.1.lcssa, %for.inc5 ], [ %B, %for.cond1.preheader.preheader ]
%i.05 = phi i64 [ %inc6, %for.inc5 ], [ 0, %for.cond1.preheader.preheader ]
%cmp21 = icmp eq i64 %n2, 0
br i1 %cmp21, label %for.inc5, label %for.body3.preheader
for.body3.preheader: ; preds = %for.cond1.preheader
br label %for.body3
for.body3: ; preds = %for.body3.preheader, %for.body3
%j.03 = phi i64 [ %inc, %for.body3 ], [ 0, %for.body3.preheader ]
%B.addr.12 = phi i32* [ %incdec.ptr, %for.body3 ], [ %B.addr.06, %for.body3.preheader ]
%conv = trunc i64 %i.05 to i32
%sub = sub nsw i64 %j.03, %i.05
%add = add i64 %sub, %n2
%arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
store i32 %conv, i32* %arrayidx, align 4
%mul = shl i64 %n2, 1
%arrayidx4 = getelementptr inbounds i32, i32* %A, i64 %mul
%0 = load i32, i32* %arrayidx4, align 4
%incdec.ptr = getelementptr inbounds i32, i32* %B.addr.12, i64 1
store i32 %0, i32* %B.addr.12, align 4
%inc = add nsw i64 %j.03, 1
%exitcond = icmp ne i64 %inc, %n2
br i1 %exitcond, label %for.body3, label %for.inc5.loopexit
for.inc5.loopexit: ; preds = %for.body3
%scevgep = getelementptr i32, i32* %B.addr.06, i64 %n2
br label %for.inc5
for.inc5: ; preds = %for.inc5.loopexit, %for.cond1.preheader
%B.addr.1.lcssa = phi i32* [ %B.addr.06, %for.cond1.preheader ], [ %scevgep, %for.inc5.loopexit ]
%inc6 = add nsw i64 %i.05, 1
%exitcond7 = icmp ne i64 %inc6, %n1
br i1 %exitcond7, label %for.cond1.preheader, label %for.end7.loopexit
for.end7.loopexit: ; preds = %for.inc5
br label %for.end7
for.end7: ; preds = %for.end7.loopexit, %entry
ret void
}

View File

@@ -0,0 +1,423 @@
; RUN: opt < %s -analyze -basicaa -da | FileCheck %s
; ModuleID = 'SymbolicSIV.bc'
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.6.0"
;; for (long int i = 0; i < n; i++) {
;; A[2*i + n] = i;
;; *B++ = A[3*i + 3*n];
define void @symbolicsiv0(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
%cmp1 = icmp eq i64 %n, 0
br i1 %cmp1, label %for.end, label %for.body.preheader
; CHECK: da analyze - none!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
for.body.preheader: ; preds = %entry
br label %for.body
for.body: ; preds = %for.body.preheader, %for.body
%i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
%B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
%conv = trunc i64 %i.03 to i32
%mul = shl nsw i64 %i.03, 1
%add = add i64 %mul, %n
%arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
store i32 %conv, i32* %arrayidx, align 4
%mul14 = add i64 %i.03, %n
%add3 = mul i64 %mul14, 3
%arrayidx4 = getelementptr inbounds i32, i32* %A, i64 %add3
%0 = load i32, i32* %arrayidx4, align 4
%incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
store i32 %0, i32* %B.addr.02, align 4
%inc = add nsw i64 %i.03, 1
%exitcond = icmp ne i64 %inc, %n
br i1 %exitcond, label %for.body, label %for.end.loopexit
for.end.loopexit: ; preds = %for.body
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
ret void
}
;; for (long int i = 0; i < n; i++) {
;; A[2*i + 5*n] = i;
;; *B++ = A[3*i + 2*n];
define void @symbolicsiv1(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
%cmp1 = icmp eq i64 %n, 0
br i1 %cmp1, label %for.end, label %for.body.preheader
; CHECK: da analyze - none!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
for.body.preheader: ; preds = %entry
br label %for.body
for.body: ; preds = %for.body.preheader, %for.body
%i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
%B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
%conv = trunc i64 %i.03 to i32
%mul = shl nsw i64 %i.03, 1
%mul1 = mul i64 %n, 5
%add = add i64 %mul, %mul1
%arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
store i32 %conv, i32* %arrayidx, align 4
%mul2 = mul nsw i64 %i.03, 3
%mul3 = shl i64 %n, 1
%add4 = add i64 %mul2, %mul3
%arrayidx5 = getelementptr inbounds i32, i32* %A, i64 %add4
%0 = load i32, i32* %arrayidx5, align 4
%incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
store i32 %0, i32* %B.addr.02, align 4
%inc = add nsw i64 %i.03, 1
%exitcond = icmp ne i64 %inc, %n
br i1 %exitcond, label %for.body, label %for.end.loopexit
for.end.loopexit: ; preds = %for.body
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
ret void
}
;; for (long int i = 0; i < n; i++) {
;; A[2*i - n] = i;
;; *B++ = A[-i + 2*n];
define void @symbolicsiv2(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
%cmp1 = icmp eq i64 %n, 0
br i1 %cmp1, label %for.end, label %for.body.preheader
; CHECK: da analyze - none!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
for.body.preheader: ; preds = %entry
br label %for.body
for.body: ; preds = %for.body.preheader, %for.body
%i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
%B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
%conv = trunc i64 %i.03 to i32
%mul = shl nsw i64 %i.03, 1
%sub = sub i64 %mul, %n
%arrayidx = getelementptr inbounds i32, i32* %A, i64 %sub
store i32 %conv, i32* %arrayidx, align 4
%mul2 = shl i64 %n, 1
%add = sub i64 %mul2, %i.03
%arrayidx3 = getelementptr inbounds i32, i32* %A, i64 %add
%0 = load i32, i32* %arrayidx3, align 4
%incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
store i32 %0, i32* %B.addr.02, align 4
%inc = add nsw i64 %i.03, 1
%exitcond = icmp ne i64 %inc, %n
br i1 %exitcond, label %for.body, label %for.end.loopexit
for.end.loopexit: ; preds = %for.body
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
ret void
}
;; for (long int i = 0; i < n; i++) {
;; A[-2*i + n + 1] = i;
;; *B++ = A[i - 2*n];
define void @symbolicsiv3(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
%cmp1 = icmp eq i64 %n, 0
br i1 %cmp1, label %for.end, label %for.body.preheader
; CHECK: da analyze - none!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
for.body.preheader: ; preds = %entry
br label %for.body
for.body: ; preds = %for.body.preheader, %for.body
%i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
%B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
%conv = trunc i64 %i.03 to i32
%mul = mul nsw i64 %i.03, -2
%add = add i64 %mul, %n
%add1 = add i64 %add, 1
%arrayidx = getelementptr inbounds i32, i32* %A, i64 %add1
store i32 %conv, i32* %arrayidx, align 4
%mul2 = shl i64 %n, 1
%sub = sub i64 %i.03, %mul2
%arrayidx3 = getelementptr inbounds i32, i32* %A, i64 %sub
%0 = load i32, i32* %arrayidx3, align 4
%incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
store i32 %0, i32* %B.addr.02, align 4
%inc = add nsw i64 %i.03, 1
%exitcond = icmp ne i64 %inc, %n
br i1 %exitcond, label %for.body, label %for.end.loopexit
for.end.loopexit: ; preds = %for.body
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
ret void
}
;; for (long int i = 0; i < n; i++) {
;; A[-2*i + 3*n] = i;
;; *B++ = A[-i + n];
define void @symbolicsiv4(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
%cmp1 = icmp eq i64 %n, 0
br i1 %cmp1, label %for.end, label %for.body.preheader
; CHECK: da analyze - none!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
for.body.preheader: ; preds = %entry
br label %for.body
for.body: ; preds = %for.body.preheader, %for.body
%i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
%B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
%conv = trunc i64 %i.03 to i32
%mul = mul nsw i64 %i.03, -2
%mul1 = mul i64 %n, 3
%add = add i64 %mul, %mul1
%arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
store i32 %conv, i32* %arrayidx, align 4
%add2 = sub i64 %n, %i.03
%arrayidx3 = getelementptr inbounds i32, i32* %A, i64 %add2
%0 = load i32, i32* %arrayidx3, align 4
%incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
store i32 %0, i32* %B.addr.02, align 4
%inc = add nsw i64 %i.03, 1
%exitcond = icmp ne i64 %inc, %n
br i1 %exitcond, label %for.body, label %for.end.loopexit
for.end.loopexit: ; preds = %for.body
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
ret void
}
;; for (long int i = 0; i < n; i++) {
;; A[-2*i - 2*n] = i;
;; *B++ = A[-i - n];
define void @symbolicsiv5(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
%cmp1 = icmp eq i64 %n, 0
br i1 %cmp1, label %for.end, label %for.body.preheader
; CHECK: da analyze - none!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
for.body.preheader: ; preds = %entry
br label %for.body
for.body: ; preds = %for.body.preheader, %for.body
%i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
%B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
%conv = trunc i64 %i.03 to i32
%mul = mul nsw i64 %i.03, -2
%mul1 = shl i64 %n, 1
%sub = sub i64 %mul, %mul1
%arrayidx = getelementptr inbounds i32, i32* %A, i64 %sub
store i32 %conv, i32* %arrayidx, align 4
%sub2 = sub nsw i64 0, %i.03
%sub3 = sub i64 %sub2, %n
%arrayidx4 = getelementptr inbounds i32, i32* %A, i64 %sub3
%0 = load i32, i32* %arrayidx4, align 4
%incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
store i32 %0, i32* %B.addr.02, align 4
%inc = add nsw i64 %i.03, 1
%exitcond = icmp ne i64 %inc, %n
br i1 %exitcond, label %for.body, label %for.end.loopexit
for.end.loopexit: ; preds = %for.body
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
ret void
}
;; why doesn't SCEV package understand that n >= 0?
;; for (long unsigned i = 0; i < n; i++) {
;; A[i + n + 1] = i;
;; *B++ = A[-i];
define void @weaktest(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
%cmp1 = icmp eq i64 %n, 0
br i1 %cmp1, label %for.end, label %for.body.preheader
; CHECK: da analyze - none!
; CHECK: da analyze - flow [*|<] splitable!
; CHECK: da analyze - split level = 1, iteration = ((0 smax (-1 + (-1 * %n))) /u 2)!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
for.body.preheader: ; preds = %entry
br label %for.body
for.body: ; preds = %for.body.preheader, %for.body
%i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
%B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
%conv = trunc i64 %i.03 to i32
%add = add i64 %i.03, %n
%add1 = add i64 %add, 1
%arrayidx = getelementptr inbounds i32, i32* %A, i64 %add1
store i32 %conv, i32* %arrayidx, align 4
%sub = sub i64 0, %i.03
%arrayidx2 = getelementptr inbounds i32, i32* %A, i64 %sub
%0 = load i32, i32* %arrayidx2, align 4
%incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
store i32 %0, i32* %B.addr.02, align 4
%inc = add i64 %i.03, 1
%exitcond = icmp ne i64 %inc, %n
br i1 %exitcond, label %for.body, label %for.end.loopexit
for.end.loopexit: ; preds = %for.body
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
ret void
}
;; for (long int i = 0; i < n; i++) {
;; A[4*N*i + M] = i;
;; *B++ = A[4*N*i + 3*M + 1];
define void @symbolicsiv6(i32* %A, i32* %B, i64 %n, i64 %N, i64 %M) nounwind uwtable ssp {
entry:
%cmp1 = icmp eq i64 %n, 0
br i1 %cmp1, label %for.end, label %for.body.preheader
; CHECK: da analyze - none!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
for.body.preheader: ; preds = %entry
br label %for.body
for.body: ; preds = %for.body.preheader, %for.body
%i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
%B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
%conv = trunc i64 %i.03 to i32
%mul = shl i64 %N, 2
%mul1 = mul i64 %mul, %i.03
%add = add i64 %mul1, %M
%arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
store i32 %conv, i32* %arrayidx, align 4
%mul2 = shl i64 %N, 2
%mul3 = mul i64 %mul2, %i.03
%mul4 = mul i64 %M, 3
%add5 = add i64 %mul3, %mul4
%add6 = add i64 %add5, 1
%arrayidx7 = getelementptr inbounds i32, i32* %A, i64 %add6
%0 = load i32, i32* %arrayidx7, align 4
%incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
store i32 %0, i32* %B.addr.02, align 4
%inc = add nsw i64 %i.03, 1
%exitcond = icmp ne i64 %inc, %n
br i1 %exitcond, label %for.body, label %for.end.loopexit
for.end.loopexit: ; preds = %for.body
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
ret void
}
;; for (long int i = 0; i < n; i++) {
;; A[2*N*i + M] = i;
;; *B++ = A[2*N*i - 3*M + 2];
define void @symbolicsiv7(i32* %A, i32* %B, i64 %n, i64 %N, i64 %M) nounwind uwtable ssp {
entry:
%cmp1 = icmp eq i64 %n, 0
br i1 %cmp1, label %for.end, label %for.body.preheader
; CHECK: da analyze - none!
; CHECK: da analyze - flow [<>]!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
for.body.preheader: ; preds = %entry
br label %for.body
for.body: ; preds = %for.body.preheader, %for.body
%i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
%B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
%conv = trunc i64 %i.03 to i32
%mul = shl i64 %N, 1
%mul1 = mul i64 %mul, %i.03
%add = add i64 %mul1, %M
%arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
store i32 %conv, i32* %arrayidx, align 4
%mul2 = shl i64 %N, 1
%mul3 = mul i64 %mul2, %i.03
%0 = mul i64 %M, -3
%sub = add i64 %mul3, %0
%add5 = add i64 %sub, 2
%arrayidx6 = getelementptr inbounds i32, i32* %A, i64 %add5
%1 = load i32, i32* %arrayidx6, align 4
%incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
store i32 %1, i32* %B.addr.02, align 4
%inc = add nsw i64 %i.03, 1
%exitcond = icmp ne i64 %inc, %n
br i1 %exitcond, label %for.body, label %for.end.loopexit
for.end.loopexit: ; preds = %for.body
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
ret void
}

View File

@@ -0,0 +1,51 @@
; RUN: opt < %s -analyze -basicaa -da
;; Check this doesn't crash.
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
;; struct s {
;; int A[10][10];
;; int C[10][10][10];
;; } S;
;; void dep_constraint_crash_test(int k,int N) {
;; for( int i=0;i<N;i++)
;; for( int j=0;j<N;j++)
;; S.A[0][0] = S.C[0][0][k];
;; }
%struct.s = type { [10 x [10 x i32]], [10 x [10 x [10 x i32]]] }
@S = common global %struct.s zeroinitializer
define void @dep_constraint_crash_test(i32 %k, i32 %N) {
entry:
%cmp12 = icmp sgt i32 %N, 0
br i1 %cmp12, label %for.cond1.preheader.lr.ph, label %for.end6
for.cond1.preheader.lr.ph:
%idxprom = sext i32 %k to i64
%arrayidx = getelementptr inbounds %struct.s, %struct.s* @S, i64 0, i32 1, i64 0, i64 0, i64 %idxprom
br label %for.body3.preheader
for.body3.preheader:
%i.013 = phi i32 [ 0, %for.cond1.preheader.lr.ph ], [ %inc5, %for.inc4 ]
br label %for.body3
for.body3:
%j.011 = phi i32 [ %inc, %for.body3 ], [ 0, %for.body3.preheader ]
%0 = load i32, i32* %arrayidx
store i32 %0, i32* getelementptr inbounds (%struct.s, %struct.s* @S, i64 0, i32 0, i64 0, i64 0)
%inc = add nuw nsw i32 %j.011, 1
%exitcond = icmp eq i32 %inc, %N
br i1 %exitcond, label %for.inc4, label %for.body3
for.inc4:
%inc5 = add nuw nsw i32 %i.013, 1
%exitcond14 = icmp eq i32 %inc5, %N
br i1 %exitcond14, label %for.end6, label %for.body3.preheader
for.end6:
ret void
}

View File

@@ -0,0 +1,280 @@
; RUN: opt < %s -analyze -basicaa -da | FileCheck %s
; ModuleID = 'WeakCrossingSIV.bc'
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.6.0"
;; for (long unsigned i = 0; i < n; i++) {
;; A[1 + n*i] = i;
;; *B++ = A[1 - n*i];
define void @weakcrossing0(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
%cmp1 = icmp eq i64 %n, 0
br i1 %cmp1, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
br label %for.body
; CHECK: da analyze - none!
; CHECK: da analyze - flow [0|<]!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
for.body: ; preds = %for.body.preheader, %for.body
%i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
%B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
%conv = trunc i64 %i.03 to i32
%mul = mul i64 %i.03, %n
%add = add i64 %mul, 1
%arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
store i32 %conv, i32* %arrayidx, align 4
%mul1 = mul i64 %i.03, %n
%sub = sub i64 1, %mul1
%arrayidx2 = getelementptr inbounds i32, i32* %A, i64 %sub
%0 = load i32, i32* %arrayidx2, align 4
%incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
store i32 %0, i32* %B.addr.02, align 4
%inc = add i64 %i.03, 1
%exitcond = icmp ne i64 %inc, %n
br i1 %exitcond, label %for.body, label %for.end.loopexit
for.end.loopexit: ; preds = %for.body
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
ret void
}
;; for (long unsigned i = 0; i < n; i++) {
;; A[n + i] = i;
;; *B++ = A[1 + n - i];
define void @weakcrossing1(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
%cmp1 = icmp eq i64 %n, 0
br i1 %cmp1, label %for.end, label %for.body.preheader
; CHECK: da analyze - none!
; CHECK: da analyze - flow [<>] splitable!
; CHECK: da analyze - split level = 1, iteration = 0!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
for.body.preheader: ; preds = %entry
br label %for.body
for.body: ; preds = %for.body.preheader, %for.body
%i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
%B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
%conv = trunc i64 %i.03 to i32
%add = add i64 %i.03, %n
%arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
store i32 %conv, i32* %arrayidx, align 4
%add1 = add i64 %n, 1
%sub = sub i64 %add1, %i.03
%arrayidx2 = getelementptr inbounds i32, i32* %A, i64 %sub
%0 = load i32, i32* %arrayidx2, align 4
%incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
store i32 %0, i32* %B.addr.02, align 4
%inc = add i64 %i.03, 1
%exitcond = icmp ne i64 %inc, %n
br i1 %exitcond, label %for.body, label %for.end.loopexit
for.end.loopexit: ; preds = %for.body
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
ret void
}
;; for (long unsigned i = 0; i < 3; i++) {
;; A[i] = i;
;; *B++ = A[6 - i];
define void @weakcrossing2(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
br label %for.body
; CHECK: da analyze - none!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
%arrayidx = getelementptr inbounds i32, i32* %A, i64 %i.02
store i32 %conv, i32* %arrayidx, align 4
%sub = sub i64 6, %i.02
%arrayidx1 = getelementptr inbounds i32, i32* %A, i64 %sub
%0 = load i32, i32* %arrayidx1, align 4
%incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add i64 %i.02, 1
%exitcond = icmp ne i64 %inc, 3
br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
}
;; for (long unsigned i = 0; i < 4; i++) {
;; A[i] = i;
;; *B++ = A[6 - i];
define void @weakcrossing3(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
br label %for.body
; CHECK: da analyze - none!
; CHECK: da analyze - flow [0|<]!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
%arrayidx = getelementptr inbounds i32, i32* %A, i64 %i.02
store i32 %conv, i32* %arrayidx, align 4
%sub = sub i64 6, %i.02
%arrayidx1 = getelementptr inbounds i32, i32* %A, i64 %sub
%0 = load i32, i32* %arrayidx1, align 4
%incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add i64 %i.02, 1
%exitcond = icmp ne i64 %inc, 4
br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
}
;; for (long unsigned i = 0; i < 10; i++) {
;; A[i] = i;
;; *B++ = A[-6 - i];
define void @weakcrossing4(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
br label %for.body
; CHECK: da analyze - none!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
%arrayidx = getelementptr inbounds i32, i32* %A, i64 %i.02
store i32 %conv, i32* %arrayidx, align 4
%sub = sub i64 -6, %i.02
%arrayidx1 = getelementptr inbounds i32, i32* %A, i64 %sub
%0 = load i32, i32* %arrayidx1, align 4
%incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add i64 %i.02, 1
%exitcond = icmp ne i64 %inc, 10
br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
}
;; for (long unsigned i = 0; i < n; i++) {
;; A[3*i] = i;
;; *B++ = A[5 - 3*i];
define void @weakcrossing5(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
%cmp1 = icmp eq i64 %n, 0
br i1 %cmp1, label %for.end, label %for.body.preheader
; CHECK: da analyze - none!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
for.body.preheader: ; preds = %entry
br label %for.body
for.body: ; preds = %for.body.preheader, %for.body
%i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
%B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
%conv = trunc i64 %i.03 to i32
%mul = mul i64 %i.03, 3
%arrayidx = getelementptr inbounds i32, i32* %A, i64 %mul
store i32 %conv, i32* %arrayidx, align 4
%0 = mul i64 %i.03, -3
%sub = add i64 %0, 5
%arrayidx2 = getelementptr inbounds i32, i32* %A, i64 %sub
%1 = load i32, i32* %arrayidx2, align 4
%incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
store i32 %1, i32* %B.addr.02, align 4
%inc = add i64 %i.03, 1
%exitcond = icmp ne i64 %inc, %n
br i1 %exitcond, label %for.body, label %for.end.loopexit
for.end.loopexit: ; preds = %for.body
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
ret void
}
;; for (long unsigned i = 0; i < 4; i++) {
;; A[i] = i;
;; *B++ = A[5 - i];
define void @weakcrossing6(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
br label %for.body
; CHECK: da analyze - none!
; CHECK: da analyze - flow [<>] splitable!
; CHECK: da analyze - split level = 1, iteration = 2!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
; CHECK: da analyze - confused!
; CHECK: da analyze - none!
for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
%arrayidx = getelementptr inbounds i32, i32* %A, i64 %i.02
store i32 %conv, i32* %arrayidx, align 4
%sub = sub i64 5, %i.02
%arrayidx1 = getelementptr inbounds i32, i32* %A, i64 %sub
%0 = load i32, i32* %arrayidx1, align 4
%incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add i64 %i.02, 1
%exitcond = icmp ne i64 %inc, 4
br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
}

Some files were not shown because too many files have changed in this diff Show More