From: Benjamin Kramer Date: Tue, 13 Nov 2012 12:12:02 +0000 (+0000) Subject: DependenceAnalysis: Print all dependency pairs when dumping. Update all testcases. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3eb156306a156a24b935a2ecb4277a289c270005;p=platform%2Fupstream%2Fllvm.git DependenceAnalysis: Print all dependency pairs when dumping. Update all testcases. Part of a patch by Preston Briggs. llvm-svn: 167827 --- diff --git a/llvm/lib/Analysis/DependenceAnalysis.cpp b/llvm/lib/Analysis/DependenceAnalysis.cpp index 95ac5ea..29a6f96 100644 --- a/llvm/lib/Analysis/DependenceAnalysis.cpp +++ b/llvm/lib/Analysis/DependenceAnalysis.cpp @@ -145,22 +145,20 @@ void DependenceAnalysis::getAnalysisUsage(AnalysisUsage &AU) const { // Used to test the dependence analyzer. -// Looks through the function, noting the first store instruction -// and the first load instruction -// (which always follows the first load in our tests). -// Calls depends() and prints out the result. +// Looks through the function, noting loads and stores. +// Calls depends() on every possible pair and prints out the result. // Ignores all other instructions. static void dumpExampleDependence(raw_ostream &OS, Function *F, DependenceAnalysis *DA) { for (inst_iterator SrcI = inst_begin(F), SrcE = inst_end(F); SrcI != SrcE; ++SrcI) { - if (const StoreInst *Src = dyn_cast(&*SrcI)) { + if (isa(*SrcI) || isa(*SrcI)) { for (inst_iterator DstI = SrcI, DstE = inst_end(F); DstI != DstE; ++DstI) { - if (const LoadInst *Dst = dyn_cast(&*DstI)) { + if (isa(*DstI) || isa(*DstI)) { OS << "da analyze - "; - if (Dependence *D = DA->depends(Src, Dst, true)) { + if (Dependence *D = DA->depends(&*SrcI, &*DstI, true)) { D->dump(OS); for (unsigned Level = 1; Level <= D->getLevels(); Level++) { if (D->isSplitable(Level)) { @@ -173,7 +171,6 @@ void dumpExampleDependence(raw_ostream &OS, Function *F, } else OS << "none!\n"; - return; } } } diff --git a/llvm/test/Analysis/DependenceAnalysis/Banerjee.ll b/llvm/test/Analysis/DependenceAnalysis/Banerjee.ll index 8865ee9..d498ee3 100644 --- a/llvm/test/Analysis/DependenceAnalysis/Banerjee.ll +++ b/llvm/test/Analysis/DependenceAnalysis/Banerjee.ll @@ -7,13 +7,20 @@ target triple = "x86_64-apple-macosx10.6.0" ;; for (long int i = 1; i <= 10; i++) ;; for (long int j = 1; j <= 10; j++) { -;; A[10*i + j] = ... -;; ... = A[10*i + j - 1]; +;; A[10*i + j] = 0; +;; *B++ = A[10*i + j - 1]; define void @banerjee0(i64* %A, i64* %B, i64 %m, i64 %n) nounwind uwtable ssp { entry: br label %for.cond1.preheader +; CHECK: da analyze - output [= =|<]! +; CHECK: da analyze - flow [<= <>]! +; CHECK: da analyze - confused! +; CHECK: da analyze - input [= =|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + for.cond1.preheader: ; preds = %entry, %for.inc7 %B.addr.04 = phi i64* [ %B, %entry ], [ %scevgep, %for.inc7 ] %i.03 = phi i64 [ 1, %entry ], [ %inc8, %for.inc7 ] @@ -31,7 +38,6 @@ for.body3: ; preds = %for.cond1.preheader %sub = add nsw i64 %add5, -1 %arrayidx6 = getelementptr inbounds i64* %A, i64 %sub %0 = load i64* %arrayidx6, align 8 -; CHECK: da analyze - flow [<= <>]! %incdec.ptr = getelementptr inbounds i64* %B.addr.11, i64 1 store i64 %0, i64* %B.addr.11, align 8 %inc = add nsw i64 %j.02, 1 @@ -51,14 +57,21 @@ for.end9: ; preds = %for.inc7 ;; for (long int i = 1; i <= n; i++) ;; for (long int j = 1; j <= m; j++) { -;; A[10*i + j] = ... -;; ... = A[10*i + j - 1]; +;; A[10*i + j] = 0; +;; *B++ = A[10*i + j - 1]; define void @banerjee1(i64* %A, i64* %B, i64 %m, i64 %n) nounwind uwtable ssp { entry: %cmp4 = icmp sgt i64 %n, 0 br i1 %cmp4, label %for.cond1.preheader.preheader, label %for.end9 +; CHECK: da analyze - output [* *|<]! +; CHECK: da analyze - flow [* <>]! +; CHECK: da analyze - confused! +; CHECK: da analyze - input [* *|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + for.cond1.preheader.preheader: ; preds = %entry %0 = add i64 %n, 1 br label %for.cond1.preheader @@ -85,7 +98,6 @@ for.body3: ; preds = %for.body3.preheader %sub = add nsw i64 %add5, -1 %arrayidx6 = getelementptr inbounds i64* %A, i64 %sub %2 = load i64* %arrayidx6, align 8 -; CHECK: da analyze - flow [* <>]! %incdec.ptr = getelementptr inbounds i64* %B.addr.12, i64 1 store i64 %2, i64* %B.addr.12, align 8 %inc = add nsw i64 %j.03, 1 @@ -119,6 +131,13 @@ define void @banerjee2(i64* %A, i64* %B, i64 %m, i64 %n) nounwind uwtable ssp { entry: br label %for.cond1.preheader +; CHECK: da analyze - output [= =|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - input [= =|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + for.cond1.preheader: ; preds = %entry, %for.inc8 %B.addr.04 = phi i64* [ %B, %entry ], [ %scevgep, %for.inc8 ] %i.03 = phi i64 [ 0, %entry ], [ %inc9, %for.inc8 ] @@ -136,7 +155,6 @@ for.body3: ; preds = %for.cond1.preheader %add6 = add nsw i64 %add5, 100 %arrayidx7 = getelementptr inbounds i64* %A, i64 %add6 %0 = load i64* %arrayidx7, align 8 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i64* %B.addr.11, i64 1 store i64 %0, i64* %B.addr.11, align 8 %inc = add nsw i64 %j.02, 1 @@ -156,13 +174,20 @@ for.end10: ; preds = %for.inc8 ;; for (long int i = 0; i < 10; i++) ;; for (long int j = 0; j < 10; j++) { -;; A[10*i + j] = ... -;; ... = A[10*i + j + 99]; +;; A[10*i + j] = 0; +;; *B++ = A[10*i + j + 99]; define void @banerjee3(i64* %A, i64* %B, i64 %m, i64 %n) nounwind uwtable ssp { entry: br label %for.cond1.preheader +; CHECK: da analyze - output [= =|<]! +; CHECK: da analyze - flow [> >]! +; CHECK: da analyze - confused! +; CHECK: da analyze - input [= =|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + for.cond1.preheader: ; preds = %entry, %for.inc8 %B.addr.04 = phi i64* [ %B, %entry ], [ %scevgep, %for.inc8 ] %i.03 = phi i64 [ 0, %entry ], [ %inc9, %for.inc8 ] @@ -180,7 +205,6 @@ for.body3: ; preds = %for.cond1.preheader %add6 = add nsw i64 %add5, 99 %arrayidx7 = getelementptr inbounds i64* %A, i64 %add6 %0 = load i64* %arrayidx7, align 8 -; CHECK: da analyze - flow [> >]! %incdec.ptr = getelementptr inbounds i64* %B.addr.11, i64 1 store i64 %0, i64* %B.addr.11, align 8 %inc = add nsw i64 %j.02, 1 @@ -200,13 +224,20 @@ for.end10: ; preds = %for.inc8 ;; for (long int i = 0; i < 10; i++) ;; for (long int j = 0; j < 10; j++) { -;; A[10*i + j] = ... -;; ... = A[10*i + j - 100]; +;; A[10*i + j] = 0; +;; *B++ = A[10*i + j - 100]; define void @banerjee4(i64* %A, i64* %B, i64 %m, i64 %n) nounwind uwtable ssp { entry: br label %for.cond1.preheader +; CHECK: da analyze - output [= =|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - input [= =|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + for.cond1.preheader: ; preds = %entry, %for.inc7 %B.addr.04 = phi i64* [ %B, %entry ], [ %scevgep, %for.inc7 ] %i.03 = phi i64 [ 0, %entry ], [ %inc8, %for.inc7 ] @@ -224,7 +255,6 @@ for.body3: ; preds = %for.cond1.preheader %sub = add nsw i64 %add5, -100 %arrayidx6 = getelementptr inbounds i64* %A, i64 %sub %0 = load i64* %arrayidx6, align 8 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i64* %B.addr.11, i64 1 store i64 %0, i64* %B.addr.11, align 8 %inc = add nsw i64 %j.02, 1 @@ -244,13 +274,20 @@ for.end9: ; preds = %for.inc7 ;; for (long int i = 0; i < 10; i++) ;; for (long int j = 0; j < 10; j++) { -;; A[10*i + j] = ... -;; ... = A[10*i + j - 99]; +;; A[10*i + j] = 0; +;; *B++ = A[10*i + j - 99]; define void @banerjee5(i64* %A, i64* %B, i64 %m, i64 %n) nounwind uwtable ssp { entry: br label %for.cond1.preheader +; CHECK: da analyze - output [= =|<]! +; CHECK: da analyze - flow [< <]! +; CHECK: da analyze - confused! +; CHECK: da analyze - input [= =|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + for.cond1.preheader: ; preds = %entry, %for.inc7 %B.addr.04 = phi i64* [ %B, %entry ], [ %scevgep, %for.inc7 ] %i.03 = phi i64 [ 0, %entry ], [ %inc8, %for.inc7 ] @@ -268,7 +305,6 @@ for.body3: ; preds = %for.cond1.preheader %sub = add nsw i64 %add5, -99 %arrayidx6 = getelementptr inbounds i64* %A, i64 %sub %0 = load i64* %arrayidx6, align 8 -; CHECK: da analyze - flow [< <]! %incdec.ptr = getelementptr inbounds i64* %B.addr.11, i64 1 store i64 %0, i64* %B.addr.11, align 8 %inc = add nsw i64 %j.02, 1 @@ -288,13 +324,20 @@ for.end9: ; preds = %for.inc7 ;; for (long int i = 0; i < 10; i++) ;; for (long int j = 0; j < 10; j++) { -;; A[10*i + j] = ... -;; ... = A[10*i + j + 9]; +;; A[10*i + j] = 0; +;; *B++ = A[10*i + j + 9]; define void @banerjee6(i64* %A, i64* %B, i64 %m, i64 %n) nounwind uwtable ssp { entry: br label %for.cond1.preheader +; CHECK: da analyze - output [= =|<]! +; CHECK: da analyze - flow [=> <>]! +; CHECK: da analyze - confused! +; CHECK: da analyze - input [= =|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + for.cond1.preheader: ; preds = %entry, %for.inc8 %B.addr.04 = phi i64* [ %B, %entry ], [ %scevgep, %for.inc8 ] %i.03 = phi i64 [ 0, %entry ], [ %inc9, %for.inc8 ] @@ -312,7 +355,6 @@ for.body3: ; preds = %for.cond1.preheader %add6 = add nsw i64 %add5, 9 %arrayidx7 = getelementptr inbounds i64* %A, i64 %add6 %0 = load i64* %arrayidx7, align 8 -; CHECK: da analyze - flow [=> <>]! %incdec.ptr = getelementptr inbounds i64* %B.addr.11, i64 1 store i64 %0, i64* %B.addr.11, align 8 %inc = add nsw i64 %j.02, 1 @@ -332,13 +374,20 @@ for.end10: ; preds = %for.inc8 ;; for (long int i = 0; i < 10; i++) ;; for (long int j = 0; j < 10; j++) { -;; A[10*i + j] = ... -;; ... = A[10*i + j + 10]; +;; A[10*i + j] = 0; +;; *B++ = A[10*i + j + 10]; define void @banerjee7(i64* %A, i64* %B, i64 %m, i64 %n) nounwind uwtable ssp { entry: br label %for.cond1.preheader +; CHECK: da analyze - output [= =|<]! +; CHECK: da analyze - flow [> <=]! +; CHECK: da analyze - confused! +; CHECK: da analyze - input [= =|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + for.cond1.preheader: ; preds = %entry, %for.inc8 %B.addr.04 = phi i64* [ %B, %entry ], [ %scevgep, %for.inc8 ] %i.03 = phi i64 [ 0, %entry ], [ %inc9, %for.inc8 ] @@ -356,7 +405,6 @@ for.body3: ; preds = %for.cond1.preheader %add6 = add nsw i64 %add5, 10 %arrayidx7 = getelementptr inbounds i64* %A, i64 %add6 %0 = load i64* %arrayidx7, align 8 -; CHECK: da analyze - flow [> <=]! %incdec.ptr = getelementptr inbounds i64* %B.addr.11, i64 1 store i64 %0, i64* %B.addr.11, align 8 %inc = add nsw i64 %j.02, 1 @@ -376,13 +424,20 @@ for.end10: ; preds = %for.inc8 ;; for (long int i = 0; i < 10; i++) ;; for (long int j = 0; j < 10; j++) { -;; A[10*i + j] = ... -;; ... = A[10*i + j + 11]; +;; A[10*i + j] = 0; +;; *B++ = A[10*i + j + 11]; define void @banerjee8(i64* %A, i64* %B, i64 %m, i64 %n) nounwind uwtable ssp { entry: br label %for.cond1.preheader +; CHECK: da analyze - output [= =|<]! +; CHECK: da analyze - flow [> <>]! +; CHECK: da analyze - confused! +; CHECK: da analyze - input [= =|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + for.cond1.preheader: ; preds = %entry, %for.inc8 %B.addr.04 = phi i64* [ %B, %entry ], [ %scevgep, %for.inc8 ] %i.03 = phi i64 [ 0, %entry ], [ %inc9, %for.inc8 ] @@ -400,7 +455,6 @@ for.body3: ; preds = %for.cond1.preheader %add6 = add nsw i64 %add5, 11 %arrayidx7 = getelementptr inbounds i64* %A, i64 %add6 %0 = load i64* %arrayidx7, align 8 -; CHECK: da analyze - flow [> <>]! %incdec.ptr = getelementptr inbounds i64* %B.addr.11, i64 1 store i64 %0, i64* %B.addr.11, align 8 %inc = add nsw i64 %j.02, 1 @@ -420,13 +474,20 @@ for.end10: ; preds = %for.inc8 ;; for (long int i = 0; i < 20; i++) ;; for (long int j = 0; j < 20; j++) { -;; A[30*i + 500*j] = ... -;; ... = A[i - 500*j + 11]; +;; A[30*i + 500*j] = 0; +;; *B++ = A[i - 500*j + 11]; define void @banerjee9(i64* %A, i64* %B, i64 %m, i64 %n) nounwind uwtable ssp { entry: br label %for.cond1.preheader +; CHECK: da analyze - output [* *|<]! +; CHECK: da analyze - flow [<= =|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - input [= =|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + for.cond1.preheader: ; preds = %entry, %for.inc8 %B.addr.04 = phi i64* [ %B, %entry ], [ %scevgep, %for.inc8 ] %i.03 = phi i64 [ 0, %entry ], [ %inc9, %for.inc8 ] @@ -445,7 +506,6 @@ for.body3: ; preds = %for.cond1.preheader %add6 = add nsw i64 %sub, 11 %arrayidx7 = getelementptr inbounds i64* %A, i64 %add6 %1 = load i64* %arrayidx7, align 8 -; CHECK: da analyze - flow [<= =|<]! %incdec.ptr = getelementptr inbounds i64* %B.addr.11, i64 1 store i64 %1, i64* %B.addr.11, align 8 %inc = add nsw i64 %j.02, 1 @@ -465,13 +525,20 @@ for.end10: ; preds = %for.inc8 ;; for (long int i = 0; i < 20; i++) ;; for (long int j = 0; j < 20; j++) { -;; A[i + 500*j] = ... -;; ... = A[i - 500*j + 11]; +;; A[i + 500*j] = 0; +;; *B++ = A[i - 500*j + 11]; define void @banerjee10(i64* %A, i64* %B, i64 %m, i64 %n) nounwind uwtable ssp { entry: br label %for.cond1.preheader +; CHECK: da analyze - output [= =|<]! +; CHECK: da analyze - flow [<> =]! +; CHECK: da analyze - confused! +; CHECK: da analyze - input [= =|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + for.cond1.preheader: ; preds = %entry, %for.inc7 %B.addr.04 = phi i64* [ %B, %entry ], [ %scevgep, %for.inc7 ] %i.03 = phi i64 [ 0, %entry ], [ %inc8, %for.inc7 ] @@ -489,7 +556,6 @@ for.body3: ; preds = %for.cond1.preheader %add5 = add nsw i64 %sub, 11 %arrayidx6 = getelementptr inbounds i64* %A, i64 %add5 %1 = load i64* %arrayidx6, align 8 -; CHECK: da analyze - flow [<> =]! %incdec.ptr = getelementptr inbounds i64* %B.addr.11, i64 1 store i64 %1, i64* %B.addr.11, align 8 %inc = add nsw i64 %j.02, 1 @@ -509,13 +575,20 @@ for.end9: ; preds = %for.inc7 ;; for (long int i = 0; i < 20; i++) ;; for (long int j = 0; j < 20; j++) { -;; A[300*i + j] = ... -;; ... = A[250*i - j + 11]; +;; A[300*i + j] = 0; +;; *B++ = A[250*i - j + 11]; define void @banerjee11(i64* %A, i64* %B, i64 %m, i64 %n) nounwind uwtable ssp { entry: br label %for.cond1.preheader +; CHECK: da analyze - output [= =|<]! +; CHECK: da analyze - flow [<= <>]! +; CHECK: da analyze - confused! +; CHECK: da analyze - input [= =|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + for.cond1.preheader: ; preds = %entry, %for.inc7 %B.addr.04 = phi i64* [ %B, %entry ], [ %scevgep, %for.inc7 ] %i.03 = phi i64 [ 0, %entry ], [ %inc8, %for.inc7 ] @@ -533,7 +606,6 @@ for.body3: ; preds = %for.cond1.preheader %add5 = add nsw i64 %sub, 11 %arrayidx6 = getelementptr inbounds i64* %A, i64 %add5 %0 = load i64* %arrayidx6, align 8 -; CHECK: da analyze - flow [<= <>]! %incdec.ptr = getelementptr inbounds i64* %B.addr.11, i64 1 store i64 %0, i64* %B.addr.11, align 8 %inc = add nsw i64 %j.02, 1 @@ -553,13 +625,20 @@ for.end9: ; preds = %for.inc7 ;; for (long int i = 0; i < 20; i++) ;; for (long int j = 0; j < 20; j++) { -;; A[100*i + j] = ... -;; ... = A[100*i - j + 11]; +;; A[100*i + j] = 0; +;; *B++ = A[100*i - j + 11]; define void @banerjee12(i64* %A, i64* %B, i64 %m, i64 %n) nounwind uwtable ssp { entry: br label %for.cond1.preheader +; CHECK: da analyze - output [= =|<]! +; CHECK: da analyze - flow [= <>]! +; CHECK: da analyze - confused! +; CHECK: da analyze - input [= =|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + for.cond1.preheader: ; preds = %entry, %for.inc7 %B.addr.04 = phi i64* [ %B, %entry ], [ %scevgep, %for.inc7 ] %i.03 = phi i64 [ 0, %entry ], [ %inc8, %for.inc7 ] @@ -577,7 +656,6 @@ for.body3: ; preds = %for.cond1.preheader %add5 = add nsw i64 %sub, 11 %arrayidx6 = getelementptr inbounds i64* %A, i64 %add5 %0 = load i64* %arrayidx6, align 8 -; CHECK: da analyze - flow [= <>]! %incdec.ptr = getelementptr inbounds i64* %B.addr.11, i64 1 store i64 %0, i64* %B.addr.11, align 8 %inc = add nsw i64 %j.02, 1 diff --git a/llvm/test/Analysis/DependenceAnalysis/Coupled.ll b/llvm/test/Analysis/DependenceAnalysis/Coupled.ll index 60163fe..6bf2866 100644 --- a/llvm/test/Analysis/DependenceAnalysis/Coupled.ll +++ b/llvm/test/Analysis/DependenceAnalysis/Coupled.ll @@ -5,15 +5,22 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3 target triple = "x86_64-apple-macosx10.6.0" -;; for (long int i = 0; i < 50; i++) -;; A[i][i] = ... -;; ... = A[i + 10][i + 9] +;; for (long int i = 0; i < 50; i++) { +;; A[i][i] = i; +;; *B++ = A[i + 10][i + 9]; define void @couple0([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -23,27 +30,33 @@ for.body: ; preds = %for.body, %entry %add2 = add nsw i64 %i.02, 10 %arrayidx4 = getelementptr inbounds [100 x i32]* %A, i64 %add2, i64 %add %0 = load i32* %arrayidx4, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add nsw i64 %i.02, 1 - %cmp = icmp slt i64 %inc, 50 - br i1 %cmp, label %for.body, label %for.end + %exitcond = icmp ne i64 %inc, 50 + br i1 %exitcond, label %for.body, label %for.end for.end: ; preds = %for.body ret void } -;; for (long int i = 0; i < 50; i++) -;; A[i][i] = ... -;; ... = A[i + 9][i + 9] +;; for (long int i = 0; i < 50; i++) { +;; A[i][i] = i; +;; *B++ = A[i + 9][i + 9]; define void @couple1([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - consistent flow [-9]! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -53,27 +66,33 @@ for.body: ; preds = %for.body, %entry %add2 = add nsw i64 %i.02, 9 %arrayidx4 = getelementptr inbounds [100 x i32]* %A, i64 %add2, i64 %add %0 = load i32* %arrayidx4, align 4 -; CHECK: da analyze - consistent flow [-9]! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add nsw i64 %i.02, 1 - %cmp = icmp slt i64 %inc, 50 - br i1 %cmp, label %for.body, label %for.end + %exitcond = icmp ne i64 %inc, 50 + br i1 %exitcond, label %for.body, label %for.end for.end: ; preds = %for.body ret void } -;; for (long int i = 0; i < 50; i++) -;; A[3*i - 6][3*i - 6] = ... -;; ... = A[i][i] +;; for (long int i = 0; i < 50; i++) { +;; A[3*i - 6][3*i - 6] = i; +;; *B++ = A[i][i]; define void @couple2([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - flow [*|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -85,27 +104,33 @@ for.body: ; preds = %for.body, %entry store i32 %conv, i32* %arrayidx3, align 4 %arrayidx5 = getelementptr inbounds [100 x i32]* %A, i64 %i.02, i64 %i.02 %0 = load i32* %arrayidx5, align 4 -; CHECK: da analyze - flow [*|<]! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add nsw i64 %i.02, 1 - %cmp = icmp slt i64 %inc, 50 - br i1 %cmp, label %for.body, label %for.end + %exitcond = icmp ne i64 %inc, 50 + br i1 %exitcond, label %for.body, label %for.end for.end: ; preds = %for.body ret void } -;; for (long int i = 0; i < 50; i++) -;; A[3*i - 6][3*i - 5] = ... -;; ... = A[i][i] +;; for (long int i = 0; i < 50; i++) { +;; A[3*i - 6][3*i - 5] = i; +;; *B++ = A[i][i]; define void @couple3([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -117,27 +142,33 @@ for.body: ; preds = %for.body, %entry store i32 %conv, i32* %arrayidx3, align 4 %arrayidx5 = getelementptr inbounds [100 x i32]* %A, i64 %i.02, i64 %i.02 %0 = load i32* %arrayidx5, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add nsw i64 %i.02, 1 - %cmp = icmp slt i64 %inc, 50 - br i1 %cmp, label %for.body, label %for.end + %exitcond = icmp ne i64 %inc, 50 + br i1 %exitcond, label %for.body, label %for.end for.end: ; preds = %for.body ret void } -;; for (long int i = 0; i < 50; i++) -;; A[3*i - 6][3*i - n] = ... -;; ... = A[i][i] +;; for (long int i = 0; i < 50; i++) { +;; A[3*i - 6][3*i - n] = i; +;; *B++ = A[i][i]; define void @couple4([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - flow [*|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -150,27 +181,33 @@ for.body: ; preds = %for.body, %entry store i32 %conv, i32* %arrayidx4, align 4 %arrayidx6 = getelementptr inbounds [100 x i32]* %A, i64 %i.02, i64 %i.02 %0 = load i32* %arrayidx6, align 4 -; CHECK: da analyze - flow [*|<]! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add nsw i64 %i.02, 1 - %cmp = icmp slt i64 %inc, 50 - br i1 %cmp, label %for.body, label %for.end + %exitcond = icmp ne i64 %inc, 50 + br i1 %exitcond, label %for.body, label %for.end for.end: ; preds = %for.body ret void } -;; for (long int i = 0; i < 50; i++) -;; A[3*i - n + 1][3*i - n] = ... -;; ... = A[i][i] +;; for (long int i = 0; i < 50; i++) { +;; A[3*i - n + 1][3*i - n] = i; +;; *B++ = A[i][i]; define void @couple5([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -185,27 +222,33 @@ for.body: ; preds = %for.body, %entry store i32 %conv, i32* %arrayidx5, align 4 %arrayidx7 = getelementptr inbounds [100 x i32]* %A, i64 %i.02, i64 %i.02 %0 = load i32* %arrayidx7, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add nsw i64 %i.02, 1 - %cmp = icmp slt i64 %inc, 50 - br i1 %cmp, label %for.body, label %for.end + %exitcond = icmp ne i64 %inc, 50 + br i1 %exitcond, label %for.body, label %for.end for.end: ; preds = %for.body ret void } -;; for (long int i = 0; i < 50; i++) -;; A[i][3*i - 6] = ... -;; ... = A[i][i] +;; for (long int i = 0; i < 50; i++) { +;; A[i][3*i - 6] = i; +;; *B++ = A[i][i]; define void @couple6([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - flow [=|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -215,27 +258,33 @@ for.body: ; preds = %for.body, %entry store i32 %conv, i32* %arrayidx1, align 4 %arrayidx3 = getelementptr inbounds [100 x i32]* %A, i64 %i.02, i64 %i.02 %0 = load i32* %arrayidx3, align 4 -; CHECK: da analyze - flow [=|<]! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add nsw i64 %i.02, 1 - %cmp = icmp slt i64 %inc, 50 - br i1 %cmp, label %for.body, label %for.end + %exitcond = icmp ne i64 %inc, 50 + br i1 %exitcond, label %for.body, label %for.end for.end: ; preds = %for.body ret void } -;; for (long int i = 0; i < 50; i++) -;; A[i][3*i - 5] = ... -;; ... = A[i][i] +;; for (long int i = 0; i < 50; i++) { +;; A[i][3*i - 5] = i; +;; *B++ = A[i][i]; define void @couple7([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -245,27 +294,33 @@ for.body: ; preds = %for.body, %entry store i32 %conv, i32* %arrayidx1, align 4 %arrayidx3 = getelementptr inbounds [100 x i32]* %A, i64 %i.02, i64 %i.02 %0 = load i32* %arrayidx3, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add nsw i64 %i.02, 1 - %cmp = icmp slt i64 %inc, 50 - br i1 %cmp, label %for.body, label %for.end + %exitcond = icmp ne i64 %inc, 50 + br i1 %exitcond, label %for.body, label %for.end for.end: ; preds = %for.body ret void } -;; for (long int i = 0; i <= 15; i++) -;; A[3*i - 18][3 - i] = ... -;; ... = A[i][i] +;; for (long int i = 0; i <= 15; i++) { +;; A[3*i - 18][3 - i] = i; +;; *B++ = A[i][i]; define void @couple8([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -276,27 +331,33 @@ for.body: ; preds = %for.body, %entry store i32 %conv, i32* %arrayidx2, align 4 %arrayidx4 = getelementptr inbounds [100 x i32]* %A, i64 %i.02, i64 %i.02 %0 = load i32* %arrayidx4, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add nsw i64 %i.02, 1 - %cmp = icmp slt i64 %inc, 16 - br i1 %cmp, label %for.body, label %for.end + %exitcond = icmp ne i64 %inc, 16 + br i1 %exitcond, label %for.body, label %for.end for.end: ; preds = %for.body ret void } -;; for (long int i = 0; i <= 15; i++) -;; A[3*i - 18][2 - i] = ... -;; ... = A[i][i] +;; for (long int i = 0; i <= 15; i++) { +;; A[3*i - 18][2 - i] = i; +;; *B++ = A[i][i]; define void @couple9([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -307,27 +368,34 @@ for.body: ; preds = %for.body, %entry store i32 %conv, i32* %arrayidx2, align 4 %arrayidx4 = getelementptr inbounds [100 x i32]* %A, i64 %i.02, i64 %i.02 %0 = load i32* %arrayidx4, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add nsw i64 %i.02, 1 - %cmp = icmp slt i64 %inc, 16 - br i1 %cmp, label %for.body, label %for.end + %exitcond = icmp ne i64 %inc, 16 + br i1 %exitcond, label %for.body, label %for.end for.end: ; preds = %for.body ret void } -;; for (long int i = 0; i <= 15; i++) -;; A[3*i - 18][6 - i] = ... -;; ... = A[i][i] +;; for (long int i = 0; i <= 15; i++) { +;; A[3*i - 18][6 - i] = i; +;; *B++ = A[i][i]; define void @couple10([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - flow [>] splitable! +; CHECK: da analyze - split level = 1, iteration = 3! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -338,28 +406,34 @@ for.body: ; preds = %for.body, %entry store i32 %conv, i32* %arrayidx2, align 4 %arrayidx4 = getelementptr inbounds [100 x i32]* %A, i64 %i.02, i64 %i.02 %0 = load i32* %arrayidx4, align 4 -; CHECK: da analyze - flow [>] splitable! -; CHECK: da analyze - split level = 1, iteration = 3! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add nsw i64 %i.02, 1 - %cmp = icmp slt i64 %inc, 16 - br i1 %cmp, label %for.body, label %for.end + %exitcond = icmp ne i64 %inc, 16 + br i1 %exitcond, label %for.body, label %for.end for.end: ; preds = %for.body ret void } -;; for (long int i = 0; i <= 15; i++) -;; A[3*i - 18][18 - i] = ... -;; ... = A[i][i] +;; for (long int i = 0; i <= 15; i++) { +;; A[3*i - 18][18 - i] = i; +;; *B++ = A[i][i]; define void @couple11([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - flow [=|<] splitable! +; CHECK: da analyze - split level = 1, iteration = 9! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -370,28 +444,34 @@ for.body: ; preds = %for.body, %entry store i32 %conv, i32* %arrayidx2, align 4 %arrayidx4 = getelementptr inbounds [100 x i32]* %A, i64 %i.02, i64 %i.02 %0 = load i32* %arrayidx4, align 4 -; CHECK: da analyze - flow [=|<] splitable! -; CHECK: da analyze - split level = 1, iteration = 9! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add nsw i64 %i.02, 1 - %cmp = icmp slt i64 %inc, 16 - br i1 %cmp, label %for.body, label %for.end + %exitcond = icmp ne i64 %inc, 16 + br i1 %exitcond, label %for.body, label %for.end for.end: ; preds = %for.body ret void } -;; for (long int i = 0; i <= 12; i++) -;; A[3*i - 18][22 - i] = ... -;; ... = A[i][i] +;; for (long int i = 0; i <= 12; i++) { +;; A[3*i - 18][22 - i] = i; +;; *B++ = A[i][i]; define void @couple12([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - flow [<] splitable! +; CHECK: da analyze - split level = 1, iteration = 11! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -402,28 +482,33 @@ for.body: ; preds = %for.body, %entry store i32 %conv, i32* %arrayidx2, align 4 %arrayidx4 = getelementptr inbounds [100 x i32]* %A, i64 %i.02, i64 %i.02 %0 = load i32* %arrayidx4, align 4 -; CHECK: da analyze - flow [<] splitable! -; CHECK: da analyze - split level = 1, iteration = 11! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add nsw i64 %i.02, 1 - %cmp = icmp slt i64 %inc, 13 - br i1 %cmp, label %for.body, label %for.end + %exitcond = icmp ne i64 %inc, 13 + br i1 %exitcond, label %for.body, label %for.end for.end: ; preds = %for.body ret void } -;; for (long int i = 0; i < 12; i++) -;; A[3*i - 18][22 - i] = ... -;; ... = A[i][i] +;; for (long int i = 0; i < 12; i++) { +;; A[3*i - 18][22 - i] = i; +;; *B++ = A[i][i]; define void @couple13([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -434,27 +519,33 @@ for.body: ; preds = %for.body, %entry store i32 %conv, i32* %arrayidx2, align 4 %arrayidx4 = getelementptr inbounds [100 x i32]* %A, i64 %i.02, i64 %i.02 %0 = load i32* %arrayidx4, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add nsw i64 %i.02, 1 - %cmp = icmp slt i64 %inc, 12 - br i1 %cmp, label %for.body, label %for.end + %exitcond = icmp ne i64 %inc, 12 + br i1 %exitcond, label %for.body, label %for.end for.end: ; preds = %for.body ret void } - -;; for (long int i = 0; i < 100; i++) -;; A[3*i - 18][18 - i][i] = ... -;; ... = A[i][i][i] +;; for (long int i = 0; i < 100; i++) { +;; A[3*i - 18][18 - i][i] = i; +;; *B++ = A[i][i][i]; define void @couple14([100 x [100 x i32]]* %A, i32* %B, i32 %n) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - flow [=|<] splitable! +; CHECK: da analyze - split level = 1, iteration = 9! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -465,28 +556,33 @@ for.body: ; preds = %for.body, %entry store i32 %conv, i32* %arrayidx3, align 4 %arrayidx6 = getelementptr inbounds [100 x [100 x i32]]* %A, i64 %i.02, i64 %i.02, i64 %i.02 %0 = load i32* %arrayidx6, align 4 -; CHECK: da analyze - flow [=|<] splitable! -; CHECK: da analyze - split level = 1, iteration = 9! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add nsw i64 %i.02, 1 - %cmp = icmp slt i64 %inc, 100 - br i1 %cmp, label %for.body, label %for.end + %exitcond = icmp ne i64 %inc, 100 + br i1 %exitcond, label %for.body, label %for.end for.end: ; preds = %for.body ret void } -;; for (long int i = 0; i < 100; i++) -;; A[3*i - 18][22 - i][i] = ... -;; ... = A[i][i][i] +;; for (long int i = 0; i < 100; i++) { +;; A[3*i - 18][22 - i][i] = i; +;; *B++ = A[i][i][i]; define void @couple15([100 x [100 x i32]]* %A, i32* %B, i32 %n) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -497,12 +593,11 @@ for.body: ; preds = %for.body, %entry store i32 %conv, i32* %arrayidx3, align 4 %arrayidx6 = getelementptr inbounds [100 x [100 x i32]]* %A, i64 %i.02, i64 %i.02, i64 %i.02 %0 = load i32* %arrayidx6, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add nsw i64 %i.02, 1 - %cmp = icmp slt i64 %inc, 100 - br i1 %cmp, label %for.body, label %for.end + %exitcond = icmp ne i64 %inc, 100 + br i1 %exitcond, label %for.body, label %for.end for.end: ; preds = %for.body ret void diff --git a/llvm/test/Analysis/DependenceAnalysis/ExactRDIV.ll b/llvm/test/Analysis/DependenceAnalysis/ExactRDIV.ll index aa5d254..3174a27 100644 --- a/llvm/test/Analysis/DependenceAnalysis/ExactRDIV.ll +++ b/llvm/test/Analysis/DependenceAnalysis/ExactRDIV.ll @@ -6,15 +6,22 @@ target triple = "x86_64-apple-macosx10.6.0" ;; for (long int i = 0; i < 10; i++) -;; A[4*i + 10] = ... +;; A[4*i + 10] = i; ;; for (long int j = 0; j < 10; j++) -;; ... = A[2*j + 1]; +;; *B++ = A[2*j + 1]; define void @rdiv0(i32* %A, i32* %B) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +for.body: ; preds = %entry, %for.body %i.03 = phi i64 [ 0, %entry ], [ %inc, %for.body ] %conv = trunc i64 %i.03 to i32 %mul = shl nsw i64 %i.03, 2 @@ -22,22 +29,24 @@ for.body: ; preds = %for.body, %entry %arrayidx = getelementptr inbounds i32* %A, i64 %add store i32 %conv, i32* %arrayidx, align 4 %inc = add nsw i64 %i.03, 1 - %cmp = icmp slt i64 %inc, 10 - br i1 %cmp, label %for.body, label %for.body4 + %exitcond5 = icmp ne i64 %inc, 10 + br i1 %exitcond5, label %for.body, label %for.body4.preheader -for.body4: ; preds = %for.body4, %for.body - %j.02 = phi i64 [ %inc9, %for.body4 ], [ 0, %for.body ] - %B.addr.01 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body ] +for.body4.preheader: ; preds = %for.body + br label %for.body4 + +for.body4: ; preds = %for.body4.preheader, %for.body4 + %j.02 = phi i64 [ %inc9, %for.body4 ], [ 0, %for.body4.preheader ] + %B.addr.01 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body4.preheader ] %mul5 = shl nsw i64 %j.02, 1 %add64 = or i64 %mul5, 1 %arrayidx7 = getelementptr inbounds i32* %A, i64 %add64 %0 = load i32* %arrayidx7, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc9 = add nsw i64 %j.02, 1 - %cmp2 = icmp slt i64 %inc9, 10 - br i1 %cmp2, label %for.body4, label %for.end10 + %exitcond = icmp ne i64 %inc9, 10 + br i1 %exitcond, label %for.body4, label %for.end10 for.end10: ; preds = %for.body4 ret void @@ -45,15 +54,22 @@ for.end10: ; preds = %for.body4 ;; for (long int i = 0; i < 5; i++) -;; A[11*i - 45] = ... +;; A[11*i - 45] = i; ;; for (long int j = 0; j < 10; j++) -;; ... = A[j]; +;; *B++ = A[j]; define void @rdiv1(i32* %A, i32* %B) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +for.body: ; preds = %entry, %for.body %i.03 = phi i64 [ 0, %entry ], [ %inc, %for.body ] %conv = trunc i64 %i.03 to i32 %mul = mul nsw i64 %i.03, 11 @@ -61,20 +77,22 @@ for.body: ; preds = %for.body, %entry %arrayidx = getelementptr inbounds i32* %A, i64 %sub store i32 %conv, i32* %arrayidx, align 4 %inc = add nsw i64 %i.03, 1 - %cmp = icmp slt i64 %inc, 5 - br i1 %cmp, label %for.body, label %for.body4 + %exitcond4 = icmp ne i64 %inc, 5 + br i1 %exitcond4, label %for.body, label %for.body4.preheader + +for.body4.preheader: ; preds = %for.body + br label %for.body4 -for.body4: ; preds = %for.body4, %for.body - %j.02 = phi i64 [ %inc7, %for.body4 ], [ 0, %for.body ] - %B.addr.01 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body ] +for.body4: ; preds = %for.body4.preheader, %for.body4 + %j.02 = phi i64 [ %inc7, %for.body4 ], [ 0, %for.body4.preheader ] + %B.addr.01 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body4.preheader ] %arrayidx5 = getelementptr inbounds i32* %A, i64 %j.02 %0 = load i32* %arrayidx5, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc7 = add nsw i64 %j.02, 1 - %cmp2 = icmp slt i64 %inc7, 10 - br i1 %cmp2, label %for.body4, label %for.end8 + %exitcond = icmp ne i64 %inc7, 10 + br i1 %exitcond, label %for.body4, label %for.end8 for.end8: ; preds = %for.body4 ret void @@ -82,15 +100,22 @@ for.end8: ; preds = %for.body4 ;; for (long int i = 0; i <= 5; i++) -;; A[11*i - 45] = ... +;; A[11*i - 45] = i; ;; for (long int j = 0; j < 10; j++) -;; ... = A[j]; +;; *B++ = A[j]; define void @rdiv2(i32* %A, i32* %B) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +for.body: ; preds = %entry, %for.body %i.03 = phi i64 [ 0, %entry ], [ %inc, %for.body ] %conv = trunc i64 %i.03 to i32 %mul = mul nsw i64 %i.03, 11 @@ -98,20 +123,22 @@ for.body: ; preds = %for.body, %entry %arrayidx = getelementptr inbounds i32* %A, i64 %sub store i32 %conv, i32* %arrayidx, align 4 %inc = add nsw i64 %i.03, 1 - %cmp = icmp slt i64 %inc, 6 - br i1 %cmp, label %for.body, label %for.body4 + %exitcond4 = icmp ne i64 %inc, 6 + br i1 %exitcond4, label %for.body, label %for.body4.preheader + +for.body4.preheader: ; preds = %for.body + br label %for.body4 -for.body4: ; preds = %for.body4, %for.body - %j.02 = phi i64 [ %inc7, %for.body4 ], [ 0, %for.body ] - %B.addr.01 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body ] +for.body4: ; preds = %for.body4.preheader, %for.body4 + %j.02 = phi i64 [ %inc7, %for.body4 ], [ 0, %for.body4.preheader ] + %B.addr.01 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body4.preheader ] %arrayidx5 = getelementptr inbounds i32* %A, i64 %j.02 %0 = load i32* %arrayidx5, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc7 = add nsw i64 %j.02, 1 - %cmp2 = icmp slt i64 %inc7, 10 - br i1 %cmp2, label %for.body4, label %for.end8 + %exitcond = icmp ne i64 %inc7, 10 + br i1 %exitcond, label %for.body4, label %for.end8 for.end8: ; preds = %for.body4 ret void @@ -119,15 +146,22 @@ for.end8: ; preds = %for.body4 ;; for (long int i = 0; i < 5; i++) -;; A[11*i - 45] = ... +;; A[11*i - 45] = i; ;; for (long int j = 0; j <= 10; j++) -;; ... = A[j]; +;; *B++ = A[j]; define void @rdiv3(i32* %A, i32* %B) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +for.body: ; preds = %entry, %for.body %i.03 = phi i64 [ 0, %entry ], [ %inc, %for.body ] %conv = trunc i64 %i.03 to i32 %mul = mul nsw i64 %i.03, 11 @@ -135,20 +169,22 @@ for.body: ; preds = %for.body, %entry %arrayidx = getelementptr inbounds i32* %A, i64 %sub store i32 %conv, i32* %arrayidx, align 4 %inc = add nsw i64 %i.03, 1 - %cmp = icmp slt i64 %inc, 5 - br i1 %cmp, label %for.body, label %for.body4 + %exitcond4 = icmp ne i64 %inc, 5 + br i1 %exitcond4, label %for.body, label %for.body4.preheader -for.body4: ; preds = %for.body4, %for.body - %j.02 = phi i64 [ %inc7, %for.body4 ], [ 0, %for.body ] - %B.addr.01 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body ] +for.body4.preheader: ; preds = %for.body + br label %for.body4 + +for.body4: ; preds = %for.body4.preheader, %for.body4 + %j.02 = phi i64 [ %inc7, %for.body4 ], [ 0, %for.body4.preheader ] + %B.addr.01 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body4.preheader ] %arrayidx5 = getelementptr inbounds i32* %A, i64 %j.02 %0 = load i32* %arrayidx5, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc7 = add nsw i64 %j.02, 1 - %cmp2 = icmp slt i64 %inc7, 11 - br i1 %cmp2, label %for.body4, label %for.end8 + %exitcond = icmp ne i64 %inc7, 11 + br i1 %exitcond, label %for.body4, label %for.end8 for.end8: ; preds = %for.body4 ret void @@ -156,15 +192,22 @@ for.end8: ; preds = %for.body4 ;; for (long int i = 0; i <= 5; i++) -;; A[11*i - 45] = ... +;; A[11*i - 45] = i; ;; for (long int j = 0; j <= 10; j++) -;; ... = A[j]; +;; *B++ = A[j]; define void @rdiv4(i32* %A, i32* %B) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - flow! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +for.body: ; preds = %entry, %for.body %i.03 = phi i64 [ 0, %entry ], [ %inc, %for.body ] %conv = trunc i64 %i.03 to i32 %mul = mul nsw i64 %i.03, 11 @@ -172,20 +215,22 @@ for.body: ; preds = %for.body, %entry %arrayidx = getelementptr inbounds i32* %A, i64 %sub store i32 %conv, i32* %arrayidx, align 4 %inc = add nsw i64 %i.03, 1 - %cmp = icmp slt i64 %inc, 6 - br i1 %cmp, label %for.body, label %for.body4 + %exitcond4 = icmp ne i64 %inc, 6 + br i1 %exitcond4, label %for.body, label %for.body4.preheader -for.body4: ; preds = %for.body4, %for.body - %j.02 = phi i64 [ %inc7, %for.body4 ], [ 0, %for.body ] - %B.addr.01 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body ] +for.body4.preheader: ; preds = %for.body + br label %for.body4 + +for.body4: ; preds = %for.body4.preheader, %for.body4 + %j.02 = phi i64 [ %inc7, %for.body4 ], [ 0, %for.body4.preheader ] + %B.addr.01 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body4.preheader ] %arrayidx5 = getelementptr inbounds i32* %A, i64 %j.02 %0 = load i32* %arrayidx5, align 4 -; CHECK: da analyze - flow! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc7 = add nsw i64 %j.02, 1 - %cmp2 = icmp slt i64 %inc7, 11 - br i1 %cmp2, label %for.body4, label %for.end8 + %exitcond = icmp ne i64 %inc7, 11 + br i1 %exitcond, label %for.body4, label %for.end8 for.end8: ; preds = %for.body4 ret void @@ -193,15 +238,22 @@ for.end8: ; preds = %for.body4 ;; for (long int i = 0; i < 5; i++) -;; A[-11*i + 45] = ... +;; A[-11*i + 45] = i; ;; for (long int j = 0; j < 10; j++) -;; ... = A[-j]; +;; *B++ = A[-j]; define void @rdiv5(i32* %A, i32* %B) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +for.body: ; preds = %entry, %for.body %i.03 = phi i64 [ 0, %entry ], [ %inc, %for.body ] %conv = trunc i64 %i.03 to i32 %mul = mul nsw i64 %i.03, -11 @@ -209,21 +261,23 @@ for.body: ; preds = %for.body, %entry %arrayidx = getelementptr inbounds i32* %A, i64 %add store i32 %conv, i32* %arrayidx, align 4 %inc = add nsw i64 %i.03, 1 - %cmp = icmp slt i64 %inc, 5 - br i1 %cmp, label %for.body, label %for.body4 + %exitcond4 = icmp ne i64 %inc, 5 + br i1 %exitcond4, label %for.body, label %for.body4.preheader + +for.body4.preheader: ; preds = %for.body + br label %for.body4 -for.body4: ; preds = %for.body4, %for.body - %j.02 = phi i64 [ %inc7, %for.body4 ], [ 0, %for.body ] - %B.addr.01 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body ] +for.body4: ; preds = %for.body4.preheader, %for.body4 + %j.02 = phi i64 [ %inc7, %for.body4 ], [ 0, %for.body4.preheader ] + %B.addr.01 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body4.preheader ] %sub = sub nsw i64 0, %j.02 %arrayidx5 = getelementptr inbounds i32* %A, i64 %sub %0 = load i32* %arrayidx5, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc7 = add nsw i64 %j.02, 1 - %cmp2 = icmp slt i64 %inc7, 10 - br i1 %cmp2, label %for.body4, label %for.end8 + %exitcond = icmp ne i64 %inc7, 10 + br i1 %exitcond, label %for.body4, label %for.end8 for.end8: ; preds = %for.body4 ret void @@ -231,15 +285,22 @@ for.end8: ; preds = %for.body4 ;; for (long int i = 0; i <= 5; i++) -;; A[-11*i + 45] = ... +;; A[-11*i + 45] = i; ;; for (long int j = 0; j < 10; j++) -;; ... = A[-j]; +;; *B++ = A[-j]; define void @rdiv6(i32* %A, i32* %B) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +for.body: ; preds = %entry, %for.body %i.03 = phi i64 [ 0, %entry ], [ %inc, %for.body ] %conv = trunc i64 %i.03 to i32 %mul = mul nsw i64 %i.03, -11 @@ -247,21 +308,23 @@ for.body: ; preds = %for.body, %entry %arrayidx = getelementptr inbounds i32* %A, i64 %add store i32 %conv, i32* %arrayidx, align 4 %inc = add nsw i64 %i.03, 1 - %cmp = icmp slt i64 %inc, 6 - br i1 %cmp, label %for.body, label %for.body4 + %exitcond4 = icmp ne i64 %inc, 6 + br i1 %exitcond4, label %for.body, label %for.body4.preheader + +for.body4.preheader: ; preds = %for.body + br label %for.body4 -for.body4: ; preds = %for.body4, %for.body - %j.02 = phi i64 [ %inc7, %for.body4 ], [ 0, %for.body ] - %B.addr.01 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body ] +for.body4: ; preds = %for.body4.preheader, %for.body4 + %j.02 = phi i64 [ %inc7, %for.body4 ], [ 0, %for.body4.preheader ] + %B.addr.01 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body4.preheader ] %sub = sub nsw i64 0, %j.02 %arrayidx5 = getelementptr inbounds i32* %A, i64 %sub %0 = load i32* %arrayidx5, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc7 = add nsw i64 %j.02, 1 - %cmp2 = icmp slt i64 %inc7, 10 - br i1 %cmp2, label %for.body4, label %for.end8 + %exitcond = icmp ne i64 %inc7, 10 + br i1 %exitcond, label %for.body4, label %for.end8 for.end8: ; preds = %for.body4 ret void @@ -269,15 +332,22 @@ for.end8: ; preds = %for.body4 ;; for (long int i = 0; i < 5; i++) -;; A[-11*i + 45] = ... +;; A[-11*i + 45] = i; ;; for (long int j = 0; j <= 10; j++) -;; ... = A[-j]; +;; *B++ = A[-j]; define void @rdiv7(i32* %A, i32* %B) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +for.body: ; preds = %entry, %for.body %i.03 = phi i64 [ 0, %entry ], [ %inc, %for.body ] %conv = trunc i64 %i.03 to i32 %mul = mul nsw i64 %i.03, -11 @@ -285,21 +355,23 @@ for.body: ; preds = %for.body, %entry %arrayidx = getelementptr inbounds i32* %A, i64 %add store i32 %conv, i32* %arrayidx, align 4 %inc = add nsw i64 %i.03, 1 - %cmp = icmp slt i64 %inc, 5 - br i1 %cmp, label %for.body, label %for.body4 + %exitcond4 = icmp ne i64 %inc, 5 + br i1 %exitcond4, label %for.body, label %for.body4.preheader -for.body4: ; preds = %for.body4, %for.body - %j.02 = phi i64 [ %inc7, %for.body4 ], [ 0, %for.body ] - %B.addr.01 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body ] +for.body4.preheader: ; preds = %for.body + br label %for.body4 + +for.body4: ; preds = %for.body4.preheader, %for.body4 + %j.02 = phi i64 [ %inc7, %for.body4 ], [ 0, %for.body4.preheader ] + %B.addr.01 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body4.preheader ] %sub = sub nsw i64 0, %j.02 %arrayidx5 = getelementptr inbounds i32* %A, i64 %sub %0 = load i32* %arrayidx5, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc7 = add nsw i64 %j.02, 1 - %cmp2 = icmp slt i64 %inc7, 11 - br i1 %cmp2, label %for.body4, label %for.end8 + %exitcond = icmp ne i64 %inc7, 11 + br i1 %exitcond, label %for.body4, label %for.end8 for.end8: ; preds = %for.body4 ret void @@ -307,15 +379,22 @@ for.end8: ; preds = %for.body4 ;; for (long int i = 0; i <= 5; i++) -;; A[-11*i + 45] = ... +;; A[-11*i + 45] = i; ;; for (long int j = 0; j <= 10; j++) -;; ... = A[-j]; +;; *B++ = A[-j]; define void @rdiv8(i32* %A, i32* %B) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - flow! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +for.body: ; preds = %entry, %for.body %i.03 = phi i64 [ 0, %entry ], [ %inc, %for.body ] %conv = trunc i64 %i.03 to i32 %mul = mul nsw i64 %i.03, -11 @@ -323,21 +402,23 @@ for.body: ; preds = %for.body, %entry %arrayidx = getelementptr inbounds i32* %A, i64 %add store i32 %conv, i32* %arrayidx, align 4 %inc = add nsw i64 %i.03, 1 - %cmp = icmp slt i64 %inc, 6 - br i1 %cmp, label %for.body, label %for.body4 + %exitcond4 = icmp ne i64 %inc, 6 + br i1 %exitcond4, label %for.body, label %for.body4.preheader + +for.body4.preheader: ; preds = %for.body + br label %for.body4 -for.body4: ; preds = %for.body4, %for.body - %j.02 = phi i64 [ %inc7, %for.body4 ], [ 0, %for.body ] - %B.addr.01 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body ] +for.body4: ; preds = %for.body4.preheader, %for.body4 + %j.02 = phi i64 [ %inc7, %for.body4 ], [ 0, %for.body4.preheader ] + %B.addr.01 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body4.preheader ] %sub = sub nsw i64 0, %j.02 %arrayidx5 = getelementptr inbounds i32* %A, i64 %sub %0 = load i32* %arrayidx5, align 4 -; CHECK: da analyze - flow! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc7 = add nsw i64 %j.02, 1 - %cmp2 = icmp slt i64 %inc7, 11 - br i1 %cmp2, label %for.body4, label %for.end8 + %exitcond = icmp ne i64 %inc7, 11 + br i1 %exitcond, label %for.body4, label %for.end8 for.end8: ; preds = %for.body4 ret void @@ -345,20 +426,27 @@ for.end8: ; preds = %for.body4 ;; for (long int i = 0; i < 5; i++) -;; for (long int j = 0; j < 10; j++) -;; A[11*i - j] = ... -;; ... = A[45]; +;; for (long int j = 0; j < 10; j++) { +;; A[11*i - j] = i; +;; *B++ = A[45]; define void @rdiv9(i32* %A, i32* %B) nounwind uwtable ssp { entry: br label %for.cond1.preheader -for.cond1.preheader: ; preds = %for.inc5, %entry - %B.addr.04 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.inc5 ] +; 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 - confused! + +for.cond1.preheader: ; preds = %entry, %for.inc5 + %B.addr.04 = phi i32* [ %B, %entry ], [ %scevgep, %for.inc5 ] %i.03 = phi i64 [ 0, %entry ], [ %inc6, %for.inc5 ] br label %for.body3 -for.body3: ; preds = %for.body3, %for.cond1.preheader +for.body3: ; preds = %for.cond1.preheader, %for.body3 %j.02 = phi i64 [ 0, %for.cond1.preheader ], [ %inc, %for.body3 ] %B.addr.11 = phi i32* [ %B.addr.04, %for.cond1.preheader ], [ %incdec.ptr, %for.body3 ] %conv = trunc i64 %i.03 to i32 @@ -368,38 +456,46 @@ for.body3: ; preds = %for.body3, %for.con store i32 %conv, i32* %arrayidx, align 4 %arrayidx4 = getelementptr inbounds i32* %A, i64 45 %0 = load i32* %arrayidx4, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.11, i64 1 store i32 %0, i32* %B.addr.11, align 4 %inc = add nsw i64 %j.02, 1 - %cmp2 = icmp slt i64 %inc, 10 - br i1 %cmp2, label %for.body3, label %for.inc5 + %exitcond = icmp ne i64 %inc, 10 + br i1 %exitcond, label %for.body3, label %for.inc5 for.inc5: ; preds = %for.body3 + %scevgep = getelementptr i32* %B.addr.04, i64 10 %inc6 = add nsw i64 %i.03, 1 - %cmp = icmp slt i64 %inc6, 5 - br i1 %cmp, label %for.cond1.preheader, label %for.end7 + %exitcond5 = icmp ne i64 %inc6, 5 + br i1 %exitcond5, label %for.cond1.preheader, label %for.end7 for.end7: ; preds = %for.inc5 ret void } -;; for (long int i = 0; i < 5; i++) -;; for (long int j = 0; j <= 10; j++) -;; A[11*i - j] = ... -;; ... = A[45]; + +;; for (long int i = 0; i <= 5; i++) +;; for (long int j = 0; j < 10; j++) { +;; A[11*i - j] = i; +;; *B++ = A[45]; define void @rdiv10(i32* %A, i32* %B) nounwind uwtable ssp { entry: br label %for.cond1.preheader -for.cond1.preheader: ; preds = %for.inc5, %entry - %B.addr.04 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.inc5 ] +; 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 - confused! + +for.cond1.preheader: ; preds = %entry, %for.inc5 + %B.addr.04 = phi i32* [ %B, %entry ], [ %scevgep, %for.inc5 ] %i.03 = phi i64 [ 0, %entry ], [ %inc6, %for.inc5 ] br label %for.body3 -for.body3: ; preds = %for.body3, %for.cond1.preheader +for.body3: ; preds = %for.cond1.preheader, %for.body3 %j.02 = phi i64 [ 0, %for.cond1.preheader ], [ %inc, %for.body3 ] %B.addr.11 = phi i32* [ %B.addr.04, %for.cond1.preheader ], [ %incdec.ptr, %for.body3 ] %conv = trunc i64 %i.03 to i32 @@ -409,38 +505,45 @@ for.body3: ; preds = %for.body3, %for.con store i32 %conv, i32* %arrayidx, align 4 %arrayidx4 = getelementptr inbounds i32* %A, i64 45 %0 = load i32* %arrayidx4, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.11, i64 1 store i32 %0, i32* %B.addr.11, align 4 %inc = add nsw i64 %j.02, 1 - %cmp2 = icmp slt i64 %inc, 10 - br i1 %cmp2, label %for.body3, label %for.inc5 + %exitcond = icmp ne i64 %inc, 10 + br i1 %exitcond, label %for.body3, label %for.inc5 for.inc5: ; preds = %for.body3 + %scevgep = getelementptr i32* %B.addr.04, i64 10 %inc6 = add nsw i64 %i.03, 1 - %cmp = icmp slt i64 %inc6, 6 - br i1 %cmp, label %for.cond1.preheader, label %for.end7 + %exitcond5 = icmp ne i64 %inc6, 6 + br i1 %exitcond5, label %for.cond1.preheader, label %for.end7 for.end7: ; preds = %for.inc5 ret void } -;; for (long int i = 0; i <= 5; i++) -;; for (long int j = 0; j <= 10; j++) -;; A[11*i - j] = ... -;; ... = A[45]; +;; for (long int i = 0; i < 5; i++) +;; for (long int j = 0; j <= 10; j++) { +;; A[11*i - j] = i; +;; *B++ = A[45]; define void @rdiv11(i32* %A, i32* %B) nounwind uwtable ssp { entry: br label %for.cond1.preheader -for.cond1.preheader: ; preds = %for.inc5, %entry - %B.addr.04 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.inc5 ] +; 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 - confused! + +for.cond1.preheader: ; preds = %entry, %for.inc5 + %B.addr.04 = phi i32* [ %B, %entry ], [ %scevgep, %for.inc5 ] %i.03 = phi i64 [ 0, %entry ], [ %inc6, %for.inc5 ] br label %for.body3 -for.body3: ; preds = %for.body3, %for.cond1.preheader +for.body3: ; preds = %for.cond1.preheader, %for.body3 %j.02 = phi i64 [ 0, %for.cond1.preheader ], [ %inc, %for.body3 ] %B.addr.11 = phi i32* [ %B.addr.04, %for.cond1.preheader ], [ %incdec.ptr, %for.body3 ] %conv = trunc i64 %i.03 to i32 @@ -450,38 +553,45 @@ for.body3: ; preds = %for.body3, %for.con store i32 %conv, i32* %arrayidx, align 4 %arrayidx4 = getelementptr inbounds i32* %A, i64 45 %0 = load i32* %arrayidx4, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.11, i64 1 store i32 %0, i32* %B.addr.11, align 4 %inc = add nsw i64 %j.02, 1 - %cmp2 = icmp slt i64 %inc, 11 - br i1 %cmp2, label %for.body3, label %for.inc5 + %exitcond = icmp ne i64 %inc, 11 + br i1 %exitcond, label %for.body3, label %for.inc5 for.inc5: ; preds = %for.body3 + %scevgep = getelementptr i32* %B.addr.04, i64 11 %inc6 = add nsw i64 %i.03, 1 - %cmp = icmp slt i64 %inc6, 5 - br i1 %cmp, label %for.cond1.preheader, label %for.end7 + %exitcond5 = icmp ne i64 %inc6, 5 + br i1 %exitcond5, label %for.cond1.preheader, label %for.end7 for.end7: ; preds = %for.inc5 ret void } -;; for (long int i = 0; i < 5; i++) -;; for (long int j = 0; j < 10; j++) -;; A[11*i - j] = ... -;; ... = A[45]; +;; for (long int i = 0; i <= 5; i++) +;; for (long int j = 0; j <= 10; j++) { +;; A[11*i - j] = i; +;; *B++ = A[45]; define void @rdiv12(i32* %A, i32* %B) nounwind uwtable ssp { entry: br label %for.cond1.preheader -for.cond1.preheader: ; preds = %for.inc5, %entry - %B.addr.04 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.inc5 ] +; CHECK: da analyze - output [= =|<]! +; CHECK: da analyze - flow [* *|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [S S|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +for.cond1.preheader: ; preds = %entry, %for.inc5 + %B.addr.04 = phi i32* [ %B, %entry ], [ %scevgep, %for.inc5 ] %i.03 = phi i64 [ 0, %entry ], [ %inc6, %for.inc5 ] br label %for.body3 -for.body3: ; preds = %for.body3, %for.cond1.preheader +for.body3: ; preds = %for.cond1.preheader, %for.body3 %j.02 = phi i64 [ 0, %for.cond1.preheader ], [ %inc, %for.body3 ] %B.addr.11 = phi i32* [ %B.addr.04, %for.cond1.preheader ], [ %incdec.ptr, %for.body3 ] %conv = trunc i64 %i.03 to i32 @@ -491,17 +601,17 @@ for.body3: ; preds = %for.body3, %for.con store i32 %conv, i32* %arrayidx, align 4 %arrayidx4 = getelementptr inbounds i32* %A, i64 45 %0 = load i32* %arrayidx4, align 4 -; CHECK: da analyze - flow [* *|<]! %incdec.ptr = getelementptr inbounds i32* %B.addr.11, i64 1 store i32 %0, i32* %B.addr.11, align 4 %inc = add nsw i64 %j.02, 1 - %cmp2 = icmp slt i64 %inc, 11 - br i1 %cmp2, label %for.body3, label %for.inc5 + %exitcond = icmp ne i64 %inc, 11 + br i1 %exitcond, label %for.body3, label %for.inc5 for.inc5: ; preds = %for.body3 + %scevgep = getelementptr i32* %B.addr.04, i64 11 %inc6 = add nsw i64 %i.03, 1 - %cmp = icmp slt i64 %inc6, 6 - br i1 %cmp, label %for.cond1.preheader, label %for.end7 + %exitcond5 = icmp ne i64 %inc6, 6 + br i1 %exitcond5, label %for.cond1.preheader, label %for.end7 for.end7: ; preds = %for.inc5 ret void diff --git a/llvm/test/Analysis/DependenceAnalysis/ExactSIV.ll b/llvm/test/Analysis/DependenceAnalysis/ExactSIV.ll index 71e0502..9d9dcdd 100644 --- a/llvm/test/Analysis/DependenceAnalysis/ExactSIV.ll +++ b/llvm/test/Analysis/DependenceAnalysis/ExactSIV.ll @@ -6,14 +6,21 @@ target triple = "x86_64-apple-macosx10.6.0" ;; for (long unsigned i = 0; i < 10; i++) { -;; A[i + 10] = ... -;; ... = A[2*i + 1]; +;; A[i + 10] = i; +;; *B++ = A[2*i + 1]; define void @exact0(i32* %A, i32* %B) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - flow [<=|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -24,12 +31,11 @@ for.body: ; preds = %for.body, %entry %add13 = or i64 %mul, 1 %arrayidx2 = getelementptr inbounds i32* %A, i64 %add13 %0 = load i32* %arrayidx2, align 4 -; CHECK: da analyze - flow [<=|<]! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add i64 %i.02, 1 - %cmp = icmp ult i64 %inc, 10 - br i1 %cmp, label %for.body, label %for.end + %exitcond = icmp ne i64 %inc, 10 + br i1 %exitcond, label %for.body, label %for.end for.end: ; preds = %for.body ret void @@ -37,14 +43,21 @@ for.end: ; preds = %for.body ;; for (long unsigned i = 0; i < 10; i++) { -;; A[4*i + 10] = ... -;; ... = A[2*i + 1]; +;; A[4*i + 10] = i; +;; *B++ = A[2*i + 1]; define void @exact1(i32* %A, i32* %B) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -56,12 +69,11 @@ for.body: ; preds = %for.body, %entry %add23 = or i64 %mul1, 1 %arrayidx3 = getelementptr inbounds i32* %A, i64 %add23 %0 = load i32* %arrayidx3, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add i64 %i.02, 1 - %cmp = icmp ult i64 %inc, 10 - br i1 %cmp, label %for.body, label %for.end + %exitcond = icmp ne i64 %inc, 10 + br i1 %exitcond, label %for.body, label %for.end for.end: ; preds = %for.body ret void @@ -69,14 +81,21 @@ for.end: ; preds = %for.body ;; for (long unsigned i = 0; i < 10; i++) { -;; A[6*i] = ... -;; ... = A[i + 60]; +;; A[6*i] = i; +;; *B++ = A[i + 60]; define void @exact2(i32* %A, i32* %B) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -86,12 +105,11 @@ for.body: ; preds = %for.body, %entry %add = add i64 %i.02, 60 %arrayidx1 = getelementptr inbounds i32* %A, i64 %add %0 = load i32* %arrayidx1, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add i64 %i.02, 1 - %cmp = icmp ult i64 %inc, 10 - br i1 %cmp, label %for.body, label %for.end + %exitcond = icmp ne i64 %inc, 10 + br i1 %exitcond, label %for.body, label %for.end for.end: ; preds = %for.body ret void @@ -99,14 +117,21 @@ for.end: ; preds = %for.body ;; for (long unsigned i = 0; i <= 10; i++) { -;; A[6*i] = ... -;; ... = A[i + 60]; +;; A[6*i] = i; +;; *B++ = A[i + 60]; define void @exact3(i32* %A, i32* %B) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - flow [>]! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -116,12 +141,11 @@ for.body: ; preds = %for.body, %entry %add = add i64 %i.02, 60 %arrayidx1 = getelementptr inbounds i32* %A, i64 %add %0 = load i32* %arrayidx1, align 4 -; CHECK: da analyze - flow [>]! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add i64 %i.02, 1 - %cmp = icmp ult i64 %inc, 11 - br i1 %cmp, label %for.body, label %for.end + %exitcond = icmp ne i64 %inc, 11 + br i1 %exitcond, label %for.body, label %for.end for.end: ; preds = %for.body ret void @@ -129,14 +153,21 @@ for.end: ; preds = %for.body ;; for (long unsigned i = 0; i < 12; i++) { -;; A[6*i] = ... -;; ... = A[i + 60]; +;; A[6*i] = i; +;; *B++ = A[i + 60]; define void @exact4(i32* %A, i32* %B) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - flow [>]! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -146,12 +177,11 @@ for.body: ; preds = %for.body, %entry %add = add i64 %i.02, 60 %arrayidx1 = getelementptr inbounds i32* %A, i64 %add %0 = load i32* %arrayidx1, align 4 -; CHECK: da analyze - flow [>]! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add i64 %i.02, 1 - %cmp = icmp ult i64 %inc, 12 - br i1 %cmp, label %for.body, label %for.end + %exitcond = icmp ne i64 %inc, 12 + br i1 %exitcond, label %for.body, label %for.end for.end: ; preds = %for.body ret void @@ -159,14 +189,21 @@ for.end: ; preds = %for.body ;; for (long unsigned i = 0; i <= 12; i++) { -;; A[6*i] = ... -;; ... = A[i + 60]; +;; A[6*i] = i; +;; *B++ = A[i + 60]; define void @exact5(i32* %A, i32* %B) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - flow [=>|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -176,12 +213,11 @@ for.body: ; preds = %for.body, %entry %add = add i64 %i.02, 60 %arrayidx1 = getelementptr inbounds i32* %A, i64 %add %0 = load i32* %arrayidx1, align 4 -; CHECK: da analyze - flow [=>|<]! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add i64 %i.02, 1 - %cmp = icmp ult i64 %inc, 13 - br i1 %cmp, label %for.body, label %for.end + %exitcond = icmp ne i64 %inc, 13 + br i1 %exitcond, label %for.body, label %for.end for.end: ; preds = %for.body ret void @@ -189,14 +225,21 @@ for.end: ; preds = %for.body ;; for (long unsigned i = 0; i < 18; i++) { -;; A[6*i] = ... -;; ... = A[i + 60]; +;; A[6*i] = i; +;; *B++ = A[i + 60]; define void @exact6(i32* %A, i32* %B) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - flow [=>|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -206,12 +249,11 @@ for.body: ; preds = %for.body, %entry %add = add i64 %i.02, 60 %arrayidx1 = getelementptr inbounds i32* %A, i64 %add %0 = load i32* %arrayidx1, align 4 -; CHECK: da analyze - flow [=>|<]! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add i64 %i.02, 1 - %cmp = icmp ult i64 %inc, 18 - br i1 %cmp, label %for.body, label %for.end + %exitcond = icmp ne i64 %inc, 18 + br i1 %exitcond, label %for.body, label %for.end for.end: ; preds = %for.body ret void @@ -219,14 +261,21 @@ for.end: ; preds = %for.body ;; for (long unsigned i = 0; i <= 18; i++) { -;; A[6*i] = ... -;; ... = A[i + 60]; +;; A[6*i] = i; +;; *B++ = A[i + 60]; define void @exact7(i32* %A, i32* %B) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - flow [*|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -236,12 +285,11 @@ for.body: ; preds = %for.body, %entry %add = add i64 %i.02, 60 %arrayidx1 = getelementptr inbounds i32* %A, i64 %add %0 = load i32* %arrayidx1, align 4 -; CHECK: da analyze - flow [*|<]! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add i64 %i.02, 1 - %cmp = icmp ult i64 %inc, 19 - br i1 %cmp, label %for.body, label %for.end + %exitcond = icmp ne i64 %inc, 19 + br i1 %exitcond, label %for.body, label %for.end for.end: ; preds = %for.body ret void @@ -249,14 +297,21 @@ for.end: ; preds = %for.body ;; for (long unsigned i = 0; i < 10; i++) { -;; A[-6*i] = ... -;; ... = A[-i - 60]; +;; A[-6*i] = i; +;; *B++ = A[-i - 60]; define void @exact8(i32* %A, i32* %B) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -266,12 +321,11 @@ for.body: ; preds = %for.body, %entry %sub1 = sub i64 -60, %i.02 %arrayidx2 = getelementptr inbounds i32* %A, i64 %sub1 %0 = load i32* %arrayidx2, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add i64 %i.02, 1 - %cmp = icmp ult i64 %inc, 10 - br i1 %cmp, label %for.body, label %for.end + %exitcond = icmp ne i64 %inc, 10 + br i1 %exitcond, label %for.body, label %for.end for.end: ; preds = %for.body ret void @@ -279,14 +333,21 @@ for.end: ; preds = %for.body ;; for (long unsigned i = 0; i <= 10; i++) { -;; A[-6*i] = ... -;; ... = A[-i - 60]; +;; A[-6*i] = i; +;; *B++ = A[-i - 60]; define void @exact9(i32* %A, i32* %B) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - flow [>]! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -296,12 +357,11 @@ for.body: ; preds = %for.body, %entry %sub1 = sub i64 -60, %i.02 %arrayidx2 = getelementptr inbounds i32* %A, i64 %sub1 %0 = load i32* %arrayidx2, align 4 -; CHECK: da analyze - flow [>]! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add i64 %i.02, 1 - %cmp = icmp ult i64 %inc, 11 - br i1 %cmp, label %for.body, label %for.end + %exitcond = icmp ne i64 %inc, 11 + br i1 %exitcond, label %for.body, label %for.end for.end: ; preds = %for.body ret void @@ -309,14 +369,21 @@ for.end: ; preds = %for.body ;; for (long unsigned i = 0; i < 12; i++) { -;; A[-6*i] = ... -;; ... = A[-i - 60]; +;; A[-6*i] = i; +;; *B++ = A[-i - 60]; define void @exact10(i32* %A, i32* %B) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - flow [>]! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -326,12 +393,11 @@ for.body: ; preds = %for.body, %entry %sub1 = sub i64 -60, %i.02 %arrayidx2 = getelementptr inbounds i32* %A, i64 %sub1 %0 = load i32* %arrayidx2, align 4 -; CHECK: da analyze - flow [>]! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add i64 %i.02, 1 - %cmp = icmp ult i64 %inc, 12 - br i1 %cmp, label %for.body, label %for.end + %exitcond = icmp ne i64 %inc, 12 + br i1 %exitcond, label %for.body, label %for.end for.end: ; preds = %for.body ret void @@ -339,14 +405,21 @@ for.end: ; preds = %for.body ;; for (long unsigned i = 0; i <= 12; i++) { -;; A[-6*i] = ... -;; ... = A[-i - 60]; +;; A[-6*i] = i; +;; *B++ = A[-i - 60]; define void @exact11(i32* %A, i32* %B) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - flow [=>|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -356,12 +429,11 @@ for.body: ; preds = %for.body, %entry %sub1 = sub i64 -60, %i.02 %arrayidx2 = getelementptr inbounds i32* %A, i64 %sub1 %0 = load i32* %arrayidx2, align 4 -; CHECK: da analyze - flow [=>|<]! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add i64 %i.02, 1 - %cmp = icmp ult i64 %inc, 13 - br i1 %cmp, label %for.body, label %for.end + %exitcond = icmp ne i64 %inc, 13 + br i1 %exitcond, label %for.body, label %for.end for.end: ; preds = %for.body ret void @@ -369,14 +441,21 @@ for.end: ; preds = %for.body ;; for (long unsigned i = 0; i < 18; i++) { -;; A[-6*i] = ... -;; ... = A[-i - 60]; +;; A[-6*i] = i; +;; *B++ = A[-i - 60]; define void @exact12(i32* %A, i32* %B) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - flow [=>|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -386,12 +465,11 @@ for.body: ; preds = %for.body, %entry %sub1 = sub i64 -60, %i.02 %arrayidx2 = getelementptr inbounds i32* %A, i64 %sub1 %0 = load i32* %arrayidx2, align 4 -; CHECK: da analyze - flow [=>|<]! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add i64 %i.02, 1 - %cmp = icmp ult i64 %inc, 18 - br i1 %cmp, label %for.body, label %for.end + %exitcond = icmp ne i64 %inc, 18 + br i1 %exitcond, label %for.body, label %for.end for.end: ; preds = %for.body ret void @@ -399,14 +477,21 @@ for.end: ; preds = %for.body ;; for (long unsigned i = 0; i <= 18; i++) { -;; A[-6*i] = ... -;; ... = A[-i - 60]; +;; A[-6*i] = i; +;; *B++ = A[-i - 60]; define void @exact13(i32* %A, i32* %B) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - flow [*|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -416,12 +501,11 @@ for.body: ; preds = %for.body, %entry %sub1 = sub i64 -60, %i.02 %arrayidx2 = getelementptr inbounds i32* %A, i64 %sub1 %0 = load i32* %arrayidx2, align 4 -; CHECK: da analyze - flow [*|<]! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add i64 %i.02, 1 - %cmp = icmp ult i64 %inc, 19 - br i1 %cmp, label %for.body, label %for.end + %exitcond = icmp ne i64 %inc, 19 + br i1 %exitcond, label %for.body, label %for.end for.end: ; preds = %for.body ret void diff --git a/llvm/test/Analysis/DependenceAnalysis/GCD.ll b/llvm/test/Analysis/DependenceAnalysis/GCD.ll index 94c93a8..a60c1bb 100644 --- a/llvm/test/Analysis/DependenceAnalysis/GCD.ll +++ b/llvm/test/Analysis/DependenceAnalysis/GCD.ll @@ -6,14 +6,21 @@ target triple = "x86_64-apple-macosx10.6.0" ;; for (long int i = 0; i < 100; i++) -;; for (long int j = 0; j < 100; j++) -;; A[2*i - 4*j] = ... -;; ... = A[6*i + 8*j]; +;; for (long int j = 0; j < 100; j++) { +;; A[2*i - 4*j] = i; +;; *B++ = A[6*i + 8*j]; define void @gcd0(i32* %A, i32* %B) nounwind uwtable ssp { entry: br label %for.cond1.preheader +; CHECK: da analyze - output [* *|<]! +; CHECK: da analyze - flow [=> *|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - input [* *|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + for.cond1.preheader: ; preds = %entry, %for.inc8 %B.addr.04 = phi i32* [ %B, %entry ], [ %scevgep, %for.inc8 ] %i.03 = phi i64 [ 0, %entry ], [ %inc9, %for.inc8 ] @@ -33,7 +40,6 @@ for.body3: ; preds = %for.cond1.preheader %add = add nsw i64 %mul5, %mul6 %arrayidx7 = getelementptr inbounds i32* %A, i64 %add %0 = load i32* %arrayidx7, align 4 -; CHECK: da analyze - flow [=> *|<]! %incdec.ptr = getelementptr inbounds i32* %B.addr.11, i64 1 store i32 %0, i32* %B.addr.11, align 4 %inc = add nsw i64 %j.02, 1 @@ -52,14 +58,21 @@ for.end10: ; preds = %for.inc8 ;; for (long int i = 0; i < 100; i++) -;; for (long int j = 0; j < 100; j++) -;; A[2*i - 4*j] = ... -;; ... = A[6*i + 8*j + 1]; +;; for (long int j = 0; j < 100; j++) { +;; A[2*i - 4*j] = i; +;; *B++ = A[6*i + 8*j + 1]; define void @gcd1(i32* %A, i32* %B) nounwind uwtable ssp { entry: br label %for.cond1.preheader +; CHECK: da analyze - output [* *|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - input [* *|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + for.cond1.preheader: ; preds = %entry, %for.inc9 %B.addr.04 = phi i32* [ %B, %entry ], [ %scevgep, %for.inc9 ] %i.03 = phi i64 [ 0, %entry ], [ %inc10, %for.inc9 ] @@ -80,7 +93,6 @@ for.body3: ; preds = %for.cond1.preheader %add7 = or i64 %add, 1 %arrayidx8 = getelementptr inbounds i32* %A, i64 %add7 %0 = load i32* %arrayidx8, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.11, i64 1 store i32 %0, i32* %B.addr.11, align 4 %inc = add nsw i64 %j.02, 1 @@ -99,14 +111,21 @@ for.end11: ; preds = %for.inc9 ;; for (long int i = 0; i < 100; i++) -;; for (long int j = 0; j < 100; j++) -;; A[2*i - 4*j + 1] = ... -;; ... = A[6*i + 8*j]; +;; for (long int j = 0; j < 100; j++) { +;; A[2*i - 4*j + 1] = i; +;; *B++ = A[6*i + 8*j]; define void @gcd2(i32* %A, i32* %B) nounwind uwtable ssp { entry: br label %for.cond1.preheader +; CHECK: da analyze - output [* *|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - input [* *|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + for.cond1.preheader: ; preds = %entry, %for.inc9 %B.addr.04 = phi i32* [ %B, %entry ], [ %scevgep, %for.inc9 ] %i.03 = phi i64 [ 0, %entry ], [ %inc10, %for.inc9 ] @@ -127,7 +146,6 @@ for.body3: ; preds = %for.cond1.preheader %add7 = add nsw i64 %mul5, %mul6 %arrayidx8 = getelementptr inbounds i32* %A, i64 %add7 %0 = load i32* %arrayidx8, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.11, i64 1 store i32 %0, i32* %B.addr.11, align 4 %inc = add nsw i64 %j.02, 1 @@ -146,14 +164,21 @@ for.end11: ; preds = %for.inc9 ;; for (long int i = 0; i < 100; i++) -;; for (long int j = 0; j < 100; j++) -;; A[i + 2*j] = ... -;; ... = A[i + 2*j - 1]; +;; for (long int j = 0; j < 100; j++) { +;; A[i + 2*j] = i; +;; *B++ = A[i + 2*j - 1]; define void @gcd3(i32* %A, i32* %B) nounwind uwtable ssp { entry: br label %for.cond1.preheader +; CHECK: da analyze - output [* *|<]! +; CHECK: da analyze - flow [<> *]! +; CHECK: da analyze - confused! +; CHECK: da analyze - input [* *|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + for.cond1.preheader: ; preds = %entry, %for.inc7 %B.addr.04 = phi i32* [ %B, %entry ], [ %scevgep, %for.inc7 ] %i.03 = phi i64 [ 0, %entry ], [ %inc8, %for.inc7 ] @@ -172,7 +197,6 @@ for.body3: ; preds = %for.cond1.preheader %sub = add nsw i64 %add5, -1 %arrayidx6 = getelementptr inbounds i32* %A, i64 %sub %0 = load i32* %arrayidx6, align 4 -; CHECK: da analyze - flow [<> *]! %incdec.ptr = getelementptr inbounds i32* %B.addr.11, i64 1 store i32 %0, i32* %B.addr.11, align 4 %inc = add nsw i64 %j.02, 1 @@ -190,16 +214,22 @@ for.end9: ; preds = %for.inc7 } -;; void gcd4(int *A, int *B, long int M, long int N) { -;; for (long int i = 0; i < 100; i++) -;; for (long int j = 0; j < 100; j++) { -;; A[5*i + 10*j*M + 9*M*N] = i; -;; *B++ = A[15*i + 20*j*M - 21*N*M + 4]; +;; for (long int i = 0; i < 100; i++) +;; for (long int j = 0; j < 100; j++) { +;; A[5*i + 10*j*M + 9*M*N] = i; +;; *B++ = A[15*i + 20*j*M - 21*N*M + 4]; define void @gcd4(i32* %A, i32* %B, i64 %M, i64 %N) nounwind uwtable ssp { entry: br label %for.cond1.preheader +; CHECK: da analyze - output [* *|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - input [* *|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + for.cond1.preheader: ; preds = %entry, %for.inc17 %B.addr.04 = phi i32* [ %B, %entry ], [ %scevgep, %for.inc17 ] %i.03 = phi i64 [ 0, %entry ], [ %inc18, %for.inc17 ] @@ -228,7 +258,6 @@ for.body3: ; preds = %for.cond1.preheader %add15 = add nsw i64 %sub, 4 %arrayidx16 = getelementptr inbounds i32* %A, i64 %add15 %0 = load i32* %arrayidx16, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.11, i64 1 store i32 %0, i32* %B.addr.11, align 4 %inc = add nsw i64 %j.02, 1 @@ -246,16 +275,22 @@ for.end19: ; preds = %for.inc17 } -;; void gcd5(int *A, int *B, long int M, long int N) { -;; for (long int i = 0; i < 100; i++) -;; for (long int j = 0; j < 100; j++) { -;; A[5*i + 10*j*M + 9*M*N] = i; -;; *B++ = A[15*i + 20*j*M - 21*N*M + 5]; +;; for (long int i = 0; i < 100; i++) +;; for (long int j = 0; j < 100; j++) { +;; A[5*i + 10*j*M + 9*M*N] = i; +;; *B++ = A[15*i + 20*j*M - 21*N*M + 5]; define void @gcd5(i32* %A, i32* %B, i64 %M, i64 %N) nounwind uwtable ssp { entry: br label %for.cond1.preheader +; CHECK: da analyze - output [* *|<]! +; CHECK: da analyze - flow [<> *]! +; CHECK: da analyze - confused! +; CHECK: da analyze - input [* *|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + for.cond1.preheader: ; preds = %entry, %for.inc17 %B.addr.04 = phi i32* [ %B, %entry ], [ %scevgep, %for.inc17 ] %i.03 = phi i64 [ 0, %entry ], [ %inc18, %for.inc17 ] @@ -284,7 +319,6 @@ for.body3: ; preds = %for.cond1.preheader %add15 = add nsw i64 %sub, 5 %arrayidx16 = getelementptr inbounds i32* %A, i64 %add15 %0 = load i32* %arrayidx16, align 4 -; CHECK: da analyze - flow [<> *]! %incdec.ptr = getelementptr inbounds i32* %B.addr.11, i64 1 store i32 %0, i32* %B.addr.11, align 4 %inc = add nsw i64 %j.02, 1 @@ -302,17 +336,23 @@ for.end19: ; preds = %for.inc17 } -;; void gcd6(long int n, int A[][n], int *B) { -;; for (long int i = 0; i < n; i++) -;; for (long int j = 0; j < n; j++) { -;; A[2*i][4*j] = i; -;; *B++ = A[8*i][6*j + 1]; +;; for (long int i = 0; i < n; i++) +;; for (long int j = 0; j < n; j++) { +;; A[2*i][4*j] = i; +;; *B++ = A[8*i][6*j + 1]; define void @gcd6(i64 %n, i32* %A, i32* %B) nounwind uwtable ssp { entry: %cmp4 = icmp sgt i64 %n, 0 br i1 %cmp4, label %for.cond1.preheader.preheader, label %for.end12 +; CHECK: da analyze - output [* *|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - input [* *|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + for.cond1.preheader.preheader: ; preds = %entry br label %for.cond1.preheader @@ -342,7 +382,6 @@ for.body3: ; preds = %for.body3.preheader %arrayidx8.sum = add i64 %1, %add7 %arrayidx9 = getelementptr inbounds i32* %A, i64 %arrayidx8.sum %2 = load i32* %arrayidx9, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.12, i64 1 store i32 %2, i32* %B.addr.12, align 4 %inc = add nsw i64 %j.03, 1 @@ -367,11 +406,10 @@ for.end12: ; preds = %for.end12.loopexit, } -;; void gcd7(int n, int A[][n], int *B) { -;; for (int i = 0; i < n; i++) -;; for (int j = 0; j < n; j++) { -;; A[2*i][4*j] = i; -;; *B++ = A[8*i][6*j + 1]; +;; for (int i = 0; i < n; i++) +;; for (int j = 0; j < n; j++) { +;; A[2*i][4*j] = i; +;; *B++ = A[8*i][6*j + 1]; define void @gcd7(i32 %n, i32* %A, i32* %B) nounwind uwtable ssp { entry: @@ -379,6 +417,13 @@ entry: %cmp4 = icmp sgt i32 %n, 0 br i1 %cmp4, label %for.cond1.preheader.preheader, label %for.end15 +; CHECK: da analyze - output [* *|<]! +; CHECK: da analyze - flow [* *|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - input [* *|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + for.cond1.preheader.preheader: ; preds = %entry br label %for.cond1.preheader @@ -419,7 +464,6 @@ for.body3: ; preds = %for.body3.preheader %arrayidx11.sum = add i64 %10, %idxprom8 %arrayidx12 = getelementptr inbounds i32* %A, i64 %arrayidx11.sum %11 = load i32* %arrayidx12, align 4 -; CHECK: da analyze - flow [* *|<]! %incdec.ptr = getelementptr inbounds i32* %B.addr.12, i64 1 store i32 %11, i32* %B.addr.12, align 4 %indvars.iv.next = add i64 %indvars.iv, 1 @@ -446,17 +490,23 @@ for.end15: ; preds = %for.end15.loopexit, } -;; void gcd8(int n, int *A, int *B) { -;; for (int i = 0; i < n; i++) -;; for (int j = 0; j < n; j++) { -;; A[n*2*i + 4*j] = i; -;; *B++ = A[n*8*i + 6*j + 1]; +;; for (int i = 0; i < n; i++) +;; for (int j = 0; j < n; j++) { +;; A[n*2*i + 4*j] = i; +;; *B++ = A[n*8*i + 6*j + 1]; define void @gcd8(i32 %n, i32* %A, i32* %B) nounwind uwtable ssp { entry: %cmp4 = icmp sgt i32 %n, 0 br i1 %cmp4, label %for.cond1.preheader.preheader, label %for.end15 +; CHECK: da analyze - output [* *|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - input [* *|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + for.cond1.preheader.preheader: ; preds = %entry br label %for.cond1.preheader @@ -492,7 +542,6 @@ for.body3: ; preds = %for.body3.preheader %idxprom11 = sext i32 %add10 to i64 %arrayidx12 = getelementptr inbounds i32* %A, i64 %idxprom11 %5 = load i32* %arrayidx12, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.12, i64 1 store i32 %5, i32* %B.addr.12, align 4 %indvars.iv.next = add i64 %indvars.iv, 1 @@ -518,11 +567,10 @@ for.end15: ; preds = %for.end15.loopexit, } -;; void gcd9(unsigned n, int A[][n], int *B) { -;; for (unsigned i = 0; i < n; i++) -;; for (unsigned j = 0; j < n; j++) { -;; A[2*i][4*j] = i; -;; *B++ = A[8*i][6*j + 1]; +;; for (unsigned i = 0; i < n; i++) +;; for (unsigned j = 0; j < n; j++) { +;; A[2*i][4*j] = i; +;; *B++ = A[8*i][6*j + 1]; define void @gcd9(i32 %n, i32* %A, i32* %B) nounwind uwtable ssp { entry: @@ -530,6 +578,13 @@ entry: %cmp4 = icmp eq i32 %n, 0 br i1 %cmp4, label %for.end15, label %for.cond1.preheader.preheader +; CHECK: da analyze - output [* *|<]! +; CHECK: da analyze - flow [* *|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - input [* *|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + for.cond1.preheader.preheader: ; preds = %entry br label %for.cond1.preheader @@ -570,7 +625,6 @@ for.body3: ; preds = %for.body3.preheader %arrayidx11.sum = add i64 %10, %idxprom8 %arrayidx12 = getelementptr inbounds i32* %A, i64 %arrayidx11.sum %11 = load i32* %arrayidx12, align 4 -; CHECK: da analyze - flow [* *|<]! %incdec.ptr = getelementptr inbounds i32* %B.addr.12, i64 1 store i32 %11, i32* %B.addr.12, align 4 %indvars.iv.next = add i64 %indvars.iv, 1 diff --git a/llvm/test/Analysis/DependenceAnalysis/Preliminary.ll b/llvm/test/Analysis/DependenceAnalysis/Preliminary.ll index 3ef63fd..c550158 100644 --- a/llvm/test/Analysis/DependenceAnalysis/Preliminary.ll +++ b/llvm/test/Analysis/DependenceAnalysis/Preliminary.ll @@ -1,111 +1,147 @@ -; RUN: opt < %s -analyze -basicaa -indvars -da | FileCheck %s - -; This series of tests is more interesting when debugging is enabled. +; RUN: opt < %s -analyze -basicaa -da | FileCheck %s ; ModuleID = 'Preliminary.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" -;; may alias -;; int p0(int n, int *A, int *B) { +;;int p0(int n, int *A, int *B) { ;; A[0] = n; ;; return B[1]; define i32 @p0(i32 %n, i32* %A, i32* %B) nounwind uwtable ssp { entry: store i32 %n, i32* %A, align 4 + +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input! + %arrayidx1 = getelementptr inbounds i32* %B, i64 1 %0 = load i32* %arrayidx1, align 4 -; CHECK: da analyze - confused! ret i32 %0 } -;; no alias -;; int p1(int n, int *restrict A, int *restrict B) { +;;int p1(int n, int *restrict A, int *restrict B) { ;; A[0] = n; ;; return B[1]; define i32 @p1(i32 %n, i32* noalias %A, i32* noalias %B) nounwind uwtable ssp { entry: store i32 %n, i32* %A, align 4 + +; CHECK: da analyze - confused! +; CHECK: da analyze - none! +; CHECK: da analyze - consistent input! + %arrayidx1 = getelementptr inbounds i32* %B, i64 1 %0 = load i32* %arrayidx1, align 4 -; CHECK: da analyze - none! ret i32 %0 } -;; check loop nesting levels -;; for (long int i = 0; i < n; i++) -;; for (long int j = 0; j < n; j++) -;; for (long int k = 0; k < n; k++) -;; A[i][j][k] = ... -;; for (long int k = 0; k < n; k++) -;; ... = A[i + 3][j + 2][k + 1]; + +;; for (long int i = 0; i < n; i++) { +;; for (long int j = 0; j < n; j++) { +;; for (long int k = 0; k < n; k++) { +;; A[i][j][k] = i; +;; } +;; for (long int k = 0; k < n; k++) { +;; *B++ = A[i + 3][j + 2][k + 1]; define void @p2(i64 %n, [100 x [100 x i64]]* %A, i64* %B) nounwind uwtable ssp { entry: %cmp10 = icmp sgt i64 %n, 0 - br i1 %cmp10, label %for.cond1.preheader, label %for.end26 + br i1 %cmp10, label %for.cond1.preheader.preheader, label %for.end26 + +; CHECK: da analyze - consistent output [0 0 0|<]! +; CHECK: da analyze - flow [-3 -2]! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0 0 0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! -for.cond1.preheader: ; preds = %for.inc24, %entry - %B.addr.012 = phi i64* [ %B.addr.1.lcssa, %for.inc24 ], [ %B, %entry ] - %i.011 = phi i64 [ %inc25, %for.inc24 ], [ 0, %entry ] +for.cond1.preheader.preheader: ; preds = %entry + br label %for.cond1.preheader + +for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.inc24 + %B.addr.012 = phi i64* [ %B.addr.1.lcssa, %for.inc24 ], [ %B, %for.cond1.preheader.preheader ] + %i.011 = phi i64 [ %inc25, %for.inc24 ], [ 0, %for.cond1.preheader.preheader ] %cmp26 = icmp sgt i64 %n, 0 - br i1 %cmp26, label %for.cond4.preheader, label %for.inc24 + br i1 %cmp26, label %for.cond4.preheader.preheader, label %for.inc24 + +for.cond4.preheader.preheader: ; preds = %for.cond1.preheader + br label %for.cond4.preheader -for.cond4.preheader: ; preds = %for.inc21, %for.cond1.preheader - %B.addr.18 = phi i64* [ %B.addr.2.lcssa, %for.inc21 ], [ %B.addr.012, %for.cond1.preheader ] - %j.07 = phi i64 [ %inc22, %for.inc21 ], [ 0, %for.cond1.preheader ] +for.cond4.preheader: ; preds = %for.cond4.preheader.preheader, %for.inc21 + %B.addr.18 = phi i64* [ %B.addr.2.lcssa, %for.inc21 ], [ %B.addr.012, %for.cond4.preheader.preheader ] + %j.07 = phi i64 [ %inc22, %for.inc21 ], [ 0, %for.cond4.preheader.preheader ] %cmp51 = icmp sgt i64 %n, 0 - br i1 %cmp51, label %for.body6, label %for.cond10.loopexit + br i1 %cmp51, label %for.body6.preheader, label %for.cond10.loopexit + +for.body6.preheader: ; preds = %for.cond4.preheader + br label %for.body6 -for.body6: ; preds = %for.body6, %for.cond4.preheader - %k.02 = phi i64 [ %inc, %for.body6 ], [ 0, %for.cond4.preheader ] +for.body6: ; preds = %for.body6.preheader, %for.body6 + %k.02 = phi i64 [ %inc, %for.body6 ], [ 0, %for.body6.preheader ] %arrayidx8 = getelementptr inbounds [100 x [100 x i64]]* %A, i64 %i.011, i64 %j.07, i64 %k.02 store i64 %i.011, i64* %arrayidx8, align 8 %inc = add nsw i64 %k.02, 1 - %cmp5 = icmp slt i64 %inc, %n - br i1 %cmp5, label %for.body6, label %for.cond10.loopexit + %exitcond13 = icmp ne i64 %inc, %n + br i1 %exitcond13, label %for.body6, label %for.cond10.loopexit.loopexit -for.cond10.loopexit: ; preds = %for.body6, %for.cond4.preheader +for.cond10.loopexit.loopexit: ; preds = %for.body6 + br label %for.cond10.loopexit + +for.cond10.loopexit: ; preds = %for.cond10.loopexit.loopexit, %for.cond4.preheader %cmp113 = icmp sgt i64 %n, 0 - br i1 %cmp113, label %for.body12, label %for.inc21 + br i1 %cmp113, label %for.body12.preheader, label %for.inc21 + +for.body12.preheader: ; preds = %for.cond10.loopexit + br label %for.body12 -for.body12: ; preds = %for.body12, %for.cond10.loopexit - %k9.05 = phi i64 [ %inc19, %for.body12 ], [ 0, %for.cond10.loopexit ] - %B.addr.24 = phi i64* [ %incdec.ptr, %for.body12 ], [ %B.addr.18, %for.cond10.loopexit ] +for.body12: ; preds = %for.body12.preheader, %for.body12 + %k9.05 = phi i64 [ %inc19, %for.body12 ], [ 0, %for.body12.preheader ] + %B.addr.24 = phi i64* [ %incdec.ptr, %for.body12 ], [ %B.addr.18, %for.body12.preheader ] %add = add nsw i64 %k9.05, 1 %add13 = add nsw i64 %j.07, 2 %add14 = add nsw i64 %i.011, 3 %arrayidx17 = getelementptr inbounds [100 x [100 x i64]]* %A, i64 %add14, i64 %add13, i64 %add %0 = load i64* %arrayidx17, align 8 -; CHECK: da analyze - flow [-3 -2]! %incdec.ptr = getelementptr inbounds i64* %B.addr.24, i64 1 store i64 %0, i64* %B.addr.24, align 8 %inc19 = add nsw i64 %k9.05, 1 - %cmp11 = icmp slt i64 %inc19, %n - br i1 %cmp11, label %for.body12, label %for.inc21 + %exitcond = icmp ne i64 %inc19, %n + br i1 %exitcond, label %for.body12, label %for.inc21.loopexit + +for.inc21.loopexit: ; preds = %for.body12 + %scevgep = getelementptr i64* %B.addr.18, i64 %n + br label %for.inc21 -for.inc21: ; preds = %for.body12, %for.cond10.loopexit - %B.addr.2.lcssa = phi i64* [ %B.addr.18, %for.cond10.loopexit ], [ %incdec.ptr, %for.body12 ] +for.inc21: ; preds = %for.inc21.loopexit, %for.cond10.loopexit + %B.addr.2.lcssa = phi i64* [ %B.addr.18, %for.cond10.loopexit ], [ %scevgep, %for.inc21.loopexit ] %inc22 = add nsw i64 %j.07, 1 - %cmp2 = icmp slt i64 %inc22, %n - br i1 %cmp2, label %for.cond4.preheader, label %for.inc24 + %exitcond14 = icmp ne i64 %inc22, %n + br i1 %exitcond14, label %for.cond4.preheader, label %for.inc24.loopexit -for.inc24: ; preds = %for.inc21, %for.cond1.preheader - %B.addr.1.lcssa = phi i64* [ %B.addr.012, %for.cond1.preheader ], [ %B.addr.2.lcssa, %for.inc21 ] +for.inc24.loopexit: ; preds = %for.inc21 + %B.addr.2.lcssa.lcssa = phi i64* [ %B.addr.2.lcssa, %for.inc21 ] + br label %for.inc24 + +for.inc24: ; preds = %for.inc24.loopexit, %for.cond1.preheader + %B.addr.1.lcssa = phi i64* [ %B.addr.012, %for.cond1.preheader ], [ %B.addr.2.lcssa.lcssa, %for.inc24.loopexit ] %inc25 = add nsw i64 %i.011, 1 - %cmp = icmp slt i64 %inc25, %n - br i1 %cmp, label %for.cond1.preheader, label %for.end26 + %exitcond15 = icmp ne i64 %inc25, %n + br i1 %exitcond15, label %for.cond1.preheader, label %for.end26.loopexit + +for.end26.loopexit: ; preds = %for.inc24 + br label %for.end26 -for.end26: ; preds = %for.inc24, %entry +for.end26: ; preds = %for.end26.loopexit, %entry ret void } -;; classify subscripts ;; for (long int i = 0; i < n; i++) ;; for (long int j = 0; j < n; j++) ;; for (long int k = 0; k < n; k++) @@ -118,83 +154,127 @@ for.end26: ; preds = %for.inc24, %entry ;; for (long int s = 0; s < n; s++) ;; for (long int u = 0; u < n; u++) ;; for (long int t = 0; t < n; t++) { -;; A[i - 3] [j] [2] [k-1] [2*l + 1] [m] [p + q] [r + s] = ... -;; ... = A[i + 3] [2] [u] [1-k] [3*l - 1] [o] [1 + n] [t + 2]; +;; A[i - 3] [j] [2] [k-1] [2*l + 1] [m] [p + q] [r + s] = i; +;; *B++ = A[i + 3] [2] [u] [1-k] [3*l - 1] [o] [1 + n] [t + 2]; define void @p3(i64 %n, [100 x [100 x [100 x [100 x [100 x [100 x [100 x i64]]]]]]]* %A, i64* %B) nounwind uwtable ssp { entry: %cmp44 = icmp sgt i64 %n, 0 - br i1 %cmp44, label %for.cond1.preheader, label %for.end90 + br i1 %cmp44, label %for.cond1.preheader.preheader, label %for.end90 + +; CHECK: da analyze - output [0 0 0 0 0 S * * * * S S|<]! +; CHECK: da analyze - flow [-6 * * => * * * * * * * *] splitable! +; CHECK: da analyze - split level = 3, iteration = 1! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0 S 0 0 S 0 S S S S 0 0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +for.cond1.preheader.preheader: ; preds = %entry + br label %for.cond1.preheader -for.cond1.preheader: ; preds = %for.inc88, %entry - %B.addr.046 = phi i64* [ %B.addr.1.lcssa, %for.inc88 ], [ %B, %entry ] - %i.045 = phi i64 [ %inc89, %for.inc88 ], [ 0, %entry ] +for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.inc88 + %B.addr.046 = phi i64* [ %B.addr.1.lcssa, %for.inc88 ], [ %B, %for.cond1.preheader.preheader ] + %i.045 = phi i64 [ %inc89, %for.inc88 ], [ 0, %for.cond1.preheader.preheader ] %cmp240 = icmp sgt i64 %n, 0 - br i1 %cmp240, label %for.cond4.preheader, label %for.inc88 + br i1 %cmp240, label %for.cond4.preheader.preheader, label %for.inc88 + +for.cond4.preheader.preheader: ; preds = %for.cond1.preheader + br label %for.cond4.preheader -for.cond4.preheader: ; preds = %for.inc85, %for.cond1.preheader - %B.addr.142 = phi i64* [ %B.addr.2.lcssa, %for.inc85 ], [ %B.addr.046, %for.cond1.preheader ] - %j.041 = phi i64 [ %inc86, %for.inc85 ], [ 0, %for.cond1.preheader ] +for.cond4.preheader: ; preds = %for.cond4.preheader.preheader, %for.inc85 + %B.addr.142 = phi i64* [ %B.addr.2.lcssa, %for.inc85 ], [ %B.addr.046, %for.cond4.preheader.preheader ] + %j.041 = phi i64 [ %inc86, %for.inc85 ], [ 0, %for.cond4.preheader.preheader ] %cmp536 = icmp sgt i64 %n, 0 - br i1 %cmp536, label %for.cond7.preheader, label %for.inc85 + br i1 %cmp536, label %for.cond7.preheader.preheader, label %for.inc85 -for.cond7.preheader: ; preds = %for.inc82, %for.cond4.preheader - %B.addr.238 = phi i64* [ %B.addr.3.lcssa, %for.inc82 ], [ %B.addr.142, %for.cond4.preheader ] - %k.037 = phi i64 [ %inc83, %for.inc82 ], [ 0, %for.cond4.preheader ] +for.cond7.preheader.preheader: ; preds = %for.cond4.preheader + br label %for.cond7.preheader + +for.cond7.preheader: ; preds = %for.cond7.preheader.preheader, %for.inc82 + %B.addr.238 = phi i64* [ %B.addr.3.lcssa, %for.inc82 ], [ %B.addr.142, %for.cond7.preheader.preheader ] + %k.037 = phi i64 [ %inc83, %for.inc82 ], [ 0, %for.cond7.preheader.preheader ] %cmp832 = icmp sgt i64 %n, 0 - br i1 %cmp832, label %for.cond10.preheader, label %for.inc82 + br i1 %cmp832, label %for.cond10.preheader.preheader, label %for.inc82 + +for.cond10.preheader.preheader: ; preds = %for.cond7.preheader + br label %for.cond10.preheader -for.cond10.preheader: ; preds = %for.inc79, %for.cond7.preheader - %B.addr.334 = phi i64* [ %B.addr.4.lcssa, %for.inc79 ], [ %B.addr.238, %for.cond7.preheader ] - %l.033 = phi i64 [ %inc80, %for.inc79 ], [ 0, %for.cond7.preheader ] +for.cond10.preheader: ; preds = %for.cond10.preheader.preheader, %for.inc79 + %B.addr.334 = phi i64* [ %B.addr.4.lcssa, %for.inc79 ], [ %B.addr.238, %for.cond10.preheader.preheader ] + %l.033 = phi i64 [ %inc80, %for.inc79 ], [ 0, %for.cond10.preheader.preheader ] %cmp1128 = icmp sgt i64 %n, 0 - br i1 %cmp1128, label %for.cond13.preheader, label %for.inc79 + br i1 %cmp1128, label %for.cond13.preheader.preheader, label %for.inc79 -for.cond13.preheader: ; preds = %for.inc76, %for.cond10.preheader - %B.addr.430 = phi i64* [ %B.addr.5.lcssa, %for.inc76 ], [ %B.addr.334, %for.cond10.preheader ] - %m.029 = phi i64 [ %inc77, %for.inc76 ], [ 0, %for.cond10.preheader ] +for.cond13.preheader.preheader: ; preds = %for.cond10.preheader + br label %for.cond13.preheader + +for.cond13.preheader: ; preds = %for.cond13.preheader.preheader, %for.inc76 + %B.addr.430 = phi i64* [ %B.addr.5.lcssa, %for.inc76 ], [ %B.addr.334, %for.cond13.preheader.preheader ] + %m.029 = phi i64 [ %inc77, %for.inc76 ], [ 0, %for.cond13.preheader.preheader ] %cmp1424 = icmp sgt i64 %n, 0 - br i1 %cmp1424, label %for.cond16.preheader, label %for.inc76 + br i1 %cmp1424, label %for.cond16.preheader.preheader, label %for.inc76 + +for.cond16.preheader.preheader: ; preds = %for.cond13.preheader + br label %for.cond16.preheader -for.cond16.preheader: ; preds = %for.inc73, %for.cond13.preheader - %B.addr.526 = phi i64* [ %B.addr.6.lcssa, %for.inc73 ], [ %B.addr.430, %for.cond13.preheader ] - %o.025 = phi i64 [ %inc74, %for.inc73 ], [ 0, %for.cond13.preheader ] +for.cond16.preheader: ; preds = %for.cond16.preheader.preheader, %for.inc73 + %B.addr.526 = phi i64* [ %B.addr.6.lcssa, %for.inc73 ], [ %B.addr.430, %for.cond16.preheader.preheader ] + %o.025 = phi i64 [ %inc74, %for.inc73 ], [ 0, %for.cond16.preheader.preheader ] %cmp1720 = icmp sgt i64 %n, 0 - br i1 %cmp1720, label %for.cond19.preheader, label %for.inc73 + br i1 %cmp1720, label %for.cond19.preheader.preheader, label %for.inc73 -for.cond19.preheader: ; preds = %for.inc70, %for.cond16.preheader - %B.addr.622 = phi i64* [ %B.addr.7.lcssa, %for.inc70 ], [ %B.addr.526, %for.cond16.preheader ] - %p.021 = phi i64 [ %inc71, %for.inc70 ], [ 0, %for.cond16.preheader ] +for.cond19.preheader.preheader: ; preds = %for.cond16.preheader + br label %for.cond19.preheader + +for.cond19.preheader: ; preds = %for.cond19.preheader.preheader, %for.inc70 + %B.addr.622 = phi i64* [ %B.addr.7.lcssa, %for.inc70 ], [ %B.addr.526, %for.cond19.preheader.preheader ] + %p.021 = phi i64 [ %inc71, %for.inc70 ], [ 0, %for.cond19.preheader.preheader ] %cmp2016 = icmp sgt i64 %n, 0 - br i1 %cmp2016, label %for.cond22.preheader, label %for.inc70 + br i1 %cmp2016, label %for.cond22.preheader.preheader, label %for.inc70 + +for.cond22.preheader.preheader: ; preds = %for.cond19.preheader + br label %for.cond22.preheader -for.cond22.preheader: ; preds = %for.inc67, %for.cond19.preheader - %B.addr.718 = phi i64* [ %B.addr.8.lcssa, %for.inc67 ], [ %B.addr.622, %for.cond19.preheader ] - %q.017 = phi i64 [ %inc68, %for.inc67 ], [ 0, %for.cond19.preheader ] +for.cond22.preheader: ; preds = %for.cond22.preheader.preheader, %for.inc67 + %B.addr.718 = phi i64* [ %B.addr.8.lcssa, %for.inc67 ], [ %B.addr.622, %for.cond22.preheader.preheader ] + %q.017 = phi i64 [ %inc68, %for.inc67 ], [ 0, %for.cond22.preheader.preheader ] %cmp2312 = icmp sgt i64 %n, 0 - br i1 %cmp2312, label %for.cond25.preheader, label %for.inc67 + br i1 %cmp2312, label %for.cond25.preheader.preheader, label %for.inc67 + +for.cond25.preheader.preheader: ; preds = %for.cond22.preheader + br label %for.cond25.preheader -for.cond25.preheader: ; preds = %for.inc64, %for.cond22.preheader - %B.addr.814 = phi i64* [ %B.addr.9.lcssa, %for.inc64 ], [ %B.addr.718, %for.cond22.preheader ] - %r.013 = phi i64 [ %inc65, %for.inc64 ], [ 0, %for.cond22.preheader ] +for.cond25.preheader: ; preds = %for.cond25.preheader.preheader, %for.inc64 + %B.addr.814 = phi i64* [ %B.addr.9.lcssa, %for.inc64 ], [ %B.addr.718, %for.cond25.preheader.preheader ] + %r.013 = phi i64 [ %inc65, %for.inc64 ], [ 0, %for.cond25.preheader.preheader ] %cmp268 = icmp sgt i64 %n, 0 - br i1 %cmp268, label %for.cond28.preheader, label %for.inc64 + br i1 %cmp268, label %for.cond28.preheader.preheader, label %for.inc64 -for.cond28.preheader: ; preds = %for.inc61, %for.cond25.preheader - %B.addr.910 = phi i64* [ %B.addr.10.lcssa, %for.inc61 ], [ %B.addr.814, %for.cond25.preheader ] - %s.09 = phi i64 [ %inc62, %for.inc61 ], [ 0, %for.cond25.preheader ] +for.cond28.preheader.preheader: ; preds = %for.cond25.preheader + br label %for.cond28.preheader + +for.cond28.preheader: ; preds = %for.cond28.preheader.preheader, %for.inc61 + %B.addr.910 = phi i64* [ %B.addr.10.lcssa, %for.inc61 ], [ %B.addr.814, %for.cond28.preheader.preheader ] + %s.09 = phi i64 [ %inc62, %for.inc61 ], [ 0, %for.cond28.preheader.preheader ] %cmp294 = icmp sgt i64 %n, 0 - br i1 %cmp294, label %for.cond31.preheader, label %for.inc61 + br i1 %cmp294, label %for.cond31.preheader.preheader, label %for.inc61 + +for.cond31.preheader.preheader: ; preds = %for.cond28.preheader + br label %for.cond31.preheader -for.cond31.preheader: ; preds = %for.inc58, %for.cond28.preheader - %u.06 = phi i64 [ %inc59, %for.inc58 ], [ 0, %for.cond28.preheader ] - %B.addr.105 = phi i64* [ %B.addr.11.lcssa, %for.inc58 ], [ %B.addr.910, %for.cond28.preheader ] +for.cond31.preheader: ; preds = %for.cond31.preheader.preheader, %for.inc58 + %u.06 = phi i64 [ %inc59, %for.inc58 ], [ 0, %for.cond31.preheader.preheader ] + %B.addr.105 = phi i64* [ %B.addr.11.lcssa, %for.inc58 ], [ %B.addr.910, %for.cond31.preheader.preheader ] %cmp321 = icmp sgt i64 %n, 0 - br i1 %cmp321, label %for.body33, label %for.inc58 + br i1 %cmp321, label %for.body33.preheader, label %for.inc58 -for.body33: ; preds = %for.body33, %for.cond31.preheader - %t.03 = phi i64 [ %inc, %for.body33 ], [ 0, %for.cond31.preheader ] - %B.addr.112 = phi i64* [ %incdec.ptr, %for.body33 ], [ %B.addr.105, %for.cond31.preheader ] +for.body33.preheader: ; preds = %for.cond31.preheader + br label %for.body33 + +for.body33: ; preds = %for.body33.preheader, %for.body33 + %t.03 = phi i64 [ %inc, %for.body33 ], [ 0, %for.body33.preheader ] + %B.addr.112 = phi i64* [ %incdec.ptr, %for.body33 ], [ %B.addr.105, %for.body33.preheader ] %add = add nsw i64 %r.013, %s.09 %add34 = add nsw i64 %p.021, %q.017 %mul = shl nsw i64 %l.033, 1 @@ -211,99 +291,153 @@ for.body33: ; preds = %for.body33, %for.co %add49 = add nsw i64 %i.045, 3 %arrayidx57 = getelementptr inbounds [100 x [100 x [100 x [100 x [100 x [100 x [100 x i64]]]]]]]* %A, i64 %add49, i64 2, i64 %u.06, i64 %sub48, i64 %sub47, i64 %o.025, i64 %add45, i64 %add44 %0 = load i64* %arrayidx57, align 8 -; CHECK: da analyze - flow [-6 * * => * * * * * * * *] splitable! -; CHECK: da analyze - split level = 3, iteration = 1! %incdec.ptr = getelementptr inbounds i64* %B.addr.112, i64 1 store i64 %0, i64* %B.addr.112, align 8 %inc = add nsw i64 %t.03, 1 - %cmp32 = icmp slt i64 %inc, %n - br i1 %cmp32, label %for.body33, label %for.inc58 + %exitcond = icmp ne i64 %inc, %n + br i1 %exitcond, label %for.body33, label %for.inc58.loopexit + +for.inc58.loopexit: ; preds = %for.body33 + %scevgep = getelementptr i64* %B.addr.105, i64 %n + br label %for.inc58 -for.inc58: ; preds = %for.body33, %for.cond31.preheader - %B.addr.11.lcssa = phi i64* [ %B.addr.105, %for.cond31.preheader ], [ %incdec.ptr, %for.body33 ] +for.inc58: ; preds = %for.inc58.loopexit, %for.cond31.preheader + %B.addr.11.lcssa = phi i64* [ %B.addr.105, %for.cond31.preheader ], [ %scevgep, %for.inc58.loopexit ] %inc59 = add nsw i64 %u.06, 1 - %cmp29 = icmp slt i64 %inc59, %n - br i1 %cmp29, label %for.cond31.preheader, label %for.inc61 + %exitcond48 = icmp ne i64 %inc59, %n + br i1 %exitcond48, label %for.cond31.preheader, label %for.inc61.loopexit + +for.inc61.loopexit: ; preds = %for.inc58 + %B.addr.11.lcssa.lcssa = phi i64* [ %B.addr.11.lcssa, %for.inc58 ] + br label %for.inc61 -for.inc61: ; preds = %for.inc58, %for.cond28.preheader - %B.addr.10.lcssa = phi i64* [ %B.addr.910, %for.cond28.preheader ], [ %B.addr.11.lcssa, %for.inc58 ] +for.inc61: ; preds = %for.inc61.loopexit, %for.cond28.preheader + %B.addr.10.lcssa = phi i64* [ %B.addr.910, %for.cond28.preheader ], [ %B.addr.11.lcssa.lcssa, %for.inc61.loopexit ] %inc62 = add nsw i64 %s.09, 1 - %cmp26 = icmp slt i64 %inc62, %n - br i1 %cmp26, label %for.cond28.preheader, label %for.inc64 + %exitcond49 = icmp ne i64 %inc62, %n + br i1 %exitcond49, label %for.cond28.preheader, label %for.inc64.loopexit -for.inc64: ; preds = %for.inc61, %for.cond25.preheader - %B.addr.9.lcssa = phi i64* [ %B.addr.814, %for.cond25.preheader ], [ %B.addr.10.lcssa, %for.inc61 ] +for.inc64.loopexit: ; preds = %for.inc61 + %B.addr.10.lcssa.lcssa = phi i64* [ %B.addr.10.lcssa, %for.inc61 ] + br label %for.inc64 + +for.inc64: ; preds = %for.inc64.loopexit, %for.cond25.preheader + %B.addr.9.lcssa = phi i64* [ %B.addr.814, %for.cond25.preheader ], [ %B.addr.10.lcssa.lcssa, %for.inc64.loopexit ] %inc65 = add nsw i64 %r.013, 1 - %cmp23 = icmp slt i64 %inc65, %n - br i1 %cmp23, label %for.cond25.preheader, label %for.inc67 + %exitcond50 = icmp ne i64 %inc65, %n + br i1 %exitcond50, label %for.cond25.preheader, label %for.inc67.loopexit + +for.inc67.loopexit: ; preds = %for.inc64 + %B.addr.9.lcssa.lcssa = phi i64* [ %B.addr.9.lcssa, %for.inc64 ] + br label %for.inc67 -for.inc67: ; preds = %for.inc64, %for.cond22.preheader - %B.addr.8.lcssa = phi i64* [ %B.addr.718, %for.cond22.preheader ], [ %B.addr.9.lcssa, %for.inc64 ] +for.inc67: ; preds = %for.inc67.loopexit, %for.cond22.preheader + %B.addr.8.lcssa = phi i64* [ %B.addr.718, %for.cond22.preheader ], [ %B.addr.9.lcssa.lcssa, %for.inc67.loopexit ] %inc68 = add nsw i64 %q.017, 1 - %cmp20 = icmp slt i64 %inc68, %n - br i1 %cmp20, label %for.cond22.preheader, label %for.inc70 + %exitcond51 = icmp ne i64 %inc68, %n + br i1 %exitcond51, label %for.cond22.preheader, label %for.inc70.loopexit -for.inc70: ; preds = %for.inc67, %for.cond19.preheader - %B.addr.7.lcssa = phi i64* [ %B.addr.622, %for.cond19.preheader ], [ %B.addr.8.lcssa, %for.inc67 ] +for.inc70.loopexit: ; preds = %for.inc67 + %B.addr.8.lcssa.lcssa = phi i64* [ %B.addr.8.lcssa, %for.inc67 ] + br label %for.inc70 + +for.inc70: ; preds = %for.inc70.loopexit, %for.cond19.preheader + %B.addr.7.lcssa = phi i64* [ %B.addr.622, %for.cond19.preheader ], [ %B.addr.8.lcssa.lcssa, %for.inc70.loopexit ] %inc71 = add nsw i64 %p.021, 1 - %cmp17 = icmp slt i64 %inc71, %n - br i1 %cmp17, label %for.cond19.preheader, label %for.inc73 + %exitcond52 = icmp ne i64 %inc71, %n + br i1 %exitcond52, label %for.cond19.preheader, label %for.inc73.loopexit + +for.inc73.loopexit: ; preds = %for.inc70 + %B.addr.7.lcssa.lcssa = phi i64* [ %B.addr.7.lcssa, %for.inc70 ] + br label %for.inc73 -for.inc73: ; preds = %for.inc70, %for.cond16.preheader - %B.addr.6.lcssa = phi i64* [ %B.addr.526, %for.cond16.preheader ], [ %B.addr.7.lcssa, %for.inc70 ] +for.inc73: ; preds = %for.inc73.loopexit, %for.cond16.preheader + %B.addr.6.lcssa = phi i64* [ %B.addr.526, %for.cond16.preheader ], [ %B.addr.7.lcssa.lcssa, %for.inc73.loopexit ] %inc74 = add nsw i64 %o.025, 1 - %cmp14 = icmp slt i64 %inc74, %n - br i1 %cmp14, label %for.cond16.preheader, label %for.inc76 + %exitcond53 = icmp ne i64 %inc74, %n + br i1 %exitcond53, label %for.cond16.preheader, label %for.inc76.loopexit -for.inc76: ; preds = %for.inc73, %for.cond13.preheader - %B.addr.5.lcssa = phi i64* [ %B.addr.430, %for.cond13.preheader ], [ %B.addr.6.lcssa, %for.inc73 ] +for.inc76.loopexit: ; preds = %for.inc73 + %B.addr.6.lcssa.lcssa = phi i64* [ %B.addr.6.lcssa, %for.inc73 ] + br label %for.inc76 + +for.inc76: ; preds = %for.inc76.loopexit, %for.cond13.preheader + %B.addr.5.lcssa = phi i64* [ %B.addr.430, %for.cond13.preheader ], [ %B.addr.6.lcssa.lcssa, %for.inc76.loopexit ] %inc77 = add nsw i64 %m.029, 1 - %cmp11 = icmp slt i64 %inc77, %n - br i1 %cmp11, label %for.cond13.preheader, label %for.inc79 + %exitcond54 = icmp ne i64 %inc77, %n + br i1 %exitcond54, label %for.cond13.preheader, label %for.inc79.loopexit + +for.inc79.loopexit: ; preds = %for.inc76 + %B.addr.5.lcssa.lcssa = phi i64* [ %B.addr.5.lcssa, %for.inc76 ] + br label %for.inc79 -for.inc79: ; preds = %for.inc76, %for.cond10.preheader - %B.addr.4.lcssa = phi i64* [ %B.addr.334, %for.cond10.preheader ], [ %B.addr.5.lcssa, %for.inc76 ] +for.inc79: ; preds = %for.inc79.loopexit, %for.cond10.preheader + %B.addr.4.lcssa = phi i64* [ %B.addr.334, %for.cond10.preheader ], [ %B.addr.5.lcssa.lcssa, %for.inc79.loopexit ] %inc80 = add nsw i64 %l.033, 1 - %cmp8 = icmp slt i64 %inc80, %n - br i1 %cmp8, label %for.cond10.preheader, label %for.inc82 + %exitcond55 = icmp ne i64 %inc80, %n + br i1 %exitcond55, label %for.cond10.preheader, label %for.inc82.loopexit + +for.inc82.loopexit: ; preds = %for.inc79 + %B.addr.4.lcssa.lcssa = phi i64* [ %B.addr.4.lcssa, %for.inc79 ] + br label %for.inc82 -for.inc82: ; preds = %for.inc79, %for.cond7.preheader - %B.addr.3.lcssa = phi i64* [ %B.addr.238, %for.cond7.preheader ], [ %B.addr.4.lcssa, %for.inc79 ] +for.inc82: ; preds = %for.inc82.loopexit, %for.cond7.preheader + %B.addr.3.lcssa = phi i64* [ %B.addr.238, %for.cond7.preheader ], [ %B.addr.4.lcssa.lcssa, %for.inc82.loopexit ] %inc83 = add nsw i64 %k.037, 1 - %cmp5 = icmp slt i64 %inc83, %n - br i1 %cmp5, label %for.cond7.preheader, label %for.inc85 + %exitcond56 = icmp ne i64 %inc83, %n + br i1 %exitcond56, label %for.cond7.preheader, label %for.inc85.loopexit -for.inc85: ; preds = %for.inc82, %for.cond4.preheader - %B.addr.2.lcssa = phi i64* [ %B.addr.142, %for.cond4.preheader ], [ %B.addr.3.lcssa, %for.inc82 ] +for.inc85.loopexit: ; preds = %for.inc82 + %B.addr.3.lcssa.lcssa = phi i64* [ %B.addr.3.lcssa, %for.inc82 ] + br label %for.inc85 + +for.inc85: ; preds = %for.inc85.loopexit, %for.cond4.preheader + %B.addr.2.lcssa = phi i64* [ %B.addr.142, %for.cond4.preheader ], [ %B.addr.3.lcssa.lcssa, %for.inc85.loopexit ] %inc86 = add nsw i64 %j.041, 1 - %cmp2 = icmp slt i64 %inc86, %n - br i1 %cmp2, label %for.cond4.preheader, label %for.inc88 + %exitcond57 = icmp ne i64 %inc86, %n + br i1 %exitcond57, label %for.cond4.preheader, label %for.inc88.loopexit + +for.inc88.loopexit: ; preds = %for.inc85 + %B.addr.2.lcssa.lcssa = phi i64* [ %B.addr.2.lcssa, %for.inc85 ] + br label %for.inc88 -for.inc88: ; preds = %for.inc85, %for.cond1.preheader - %B.addr.1.lcssa = phi i64* [ %B.addr.046, %for.cond1.preheader ], [ %B.addr.2.lcssa, %for.inc85 ] +for.inc88: ; preds = %for.inc88.loopexit, %for.cond1.preheader + %B.addr.1.lcssa = phi i64* [ %B.addr.046, %for.cond1.preheader ], [ %B.addr.2.lcssa.lcssa, %for.inc88.loopexit ] %inc89 = add nsw i64 %i.045, 1 - %cmp = icmp slt i64 %inc89, %n - br i1 %cmp, label %for.cond1.preheader, label %for.end90 + %exitcond58 = icmp ne i64 %inc89, %n + br i1 %exitcond58, label %for.cond1.preheader, label %for.end90.loopexit -for.end90: ; preds = %for.inc88, %entry +for.end90.loopexit: ; preds = %for.inc88 + br label %for.end90 + +for.end90: ; preds = %for.end90.loopexit, %entry ret void } -;; cleanup around chars, shorts, ints -;;void p4(int *A, int *B, long int n) -;; for (char i = 0; i < n; i++) -;; A[i + 2] = ... -;; ... = A[i]; +;;void p4(int *A, int *B, long int n) { +;; for (char i = 0; i < n; i++) { +;; A[i + 2] = i; +;; *B++ = A[i]; define void @p4(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp { entry: %cmp1 = icmp sgt i64 %n, 0 - br i1 %cmp1, label %for.body, label %for.end + br i1 %cmp1, label %for.body.preheader, label %for.end + +; CHECK: da analyze - output [*|<]! +; CHECK: da analyze - flow [*|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +for.body.preheader: ; preds = %entry + br label %for.body -for.body: ; preds = %for.body, %entry - %i.03 = phi i8 [ %inc, %for.body ], [ 0, %entry ] - %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ] +for.body: ; preds = %for.body.preheader, %for.body + %i.03 = phi i8 [ %inc, %for.body ], [ 0, %for.body.preheader ] + %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ] %conv2 = sext i8 %i.03 to i32 %conv3 = sext i8 %i.03 to i64 %add = add i64 %conv3, 2 @@ -312,32 +446,44 @@ for.body: ; preds = %for.body, %entry %idxprom4 = sext i8 %i.03 to i64 %arrayidx5 = getelementptr inbounds i32* %A, i64 %idxprom4 %0 = load i32* %arrayidx5, align 4 -; CHECK: da analyze - flow [*|<]! %incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1 store i32 %0, i32* %B.addr.02, align 4 %inc = add i8 %i.03, 1 %conv = sext i8 %inc to i64 %cmp = icmp slt i64 %conv, %n - br i1 %cmp, label %for.body, label %for.end + br i1 %cmp, label %for.body, label %for.end.loopexit + +for.end.loopexit: ; preds = %for.body + br label %for.end -for.end: ; preds = %for.body, %entry +for.end: ; preds = %for.end.loopexit, %entry ret void } -;;void p5(int *A, int *B, long int n) -;; for (short i = 0; i < n; i++) -;; A[i + 2] = ... -;; ... = A[i]; +;;void p5(int *A, int *B, long int n) { +;; for (short i = 0; i < n; i++) { +;; A[i + 2] = i; +;; *B++ = A[i]; define void @p5(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp { entry: %cmp1 = icmp sgt i64 %n, 0 - br i1 %cmp1, label %for.body, label %for.end + br i1 %cmp1, label %for.body.preheader, label %for.end + +; CHECK: da analyze - output [*|<]! +; CHECK: da analyze - flow [*|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! -for.body: ; preds = %for.body, %entry - %i.03 = phi i16 [ %inc, %for.body ], [ 0, %entry ] - %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ] +for.body.preheader: ; preds = %entry + br label %for.body + +for.body: ; preds = %for.body.preheader, %for.body + %i.03 = phi i16 [ %inc, %for.body ], [ 0, %for.body.preheader ] + %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ] %conv2 = sext i16 %i.03 to i32 %conv3 = sext i16 %i.03 to i64 %add = add i64 %conv3, 2 @@ -346,124 +492,163 @@ for.body: ; preds = %for.body, %entry %idxprom4 = sext i16 %i.03 to i64 %arrayidx5 = getelementptr inbounds i32* %A, i64 %idxprom4 %0 = load i32* %arrayidx5, align 4 -; CHECK: da analyze - flow [*|<]! %incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1 store i32 %0, i32* %B.addr.02, align 4 %inc = add i16 %i.03, 1 %conv = sext i16 %inc to i64 %cmp = icmp slt i64 %conv, %n - br i1 %cmp, label %for.body, label %for.end + br i1 %cmp, label %for.body, label %for.end.loopexit -for.end: ; preds = %for.body, %entry +for.end.loopexit: ; preds = %for.body + br label %for.end + +for.end: ; preds = %for.end.loopexit, %entry ret void } -;;void p6(int *A, int *B, long int n) -;; for (int i = 0; i < n; i++) -;; A[i + 2] = ... -;; ... = A[i]; +;;void p6(int *A, int *B, long int n) { +;; for (int i = 0; i < n; i++) { +;; A[i + 2] = i; +;; *B++ = A[i]; define void @p6(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp { entry: %cmp1 = icmp sgt i64 %n, 0 - br i1 %cmp1, label %for.body, label %for.end + br i1 %cmp1, label %for.body.preheader, label %for.end -for.body: ; preds = %for.body, %entry - %i.03 = phi i32 [ %inc, %for.body ], [ 0, %entry ] - %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ] - %add = add nsw i32 %i.03, 2 - %idxprom = sext i32 %add to i64 - %arrayidx = getelementptr inbounds i32* %A, i64 %idxprom - store i32 %i.03, i32* %arrayidx, align 4 - %idxprom2 = sext i32 %i.03 to i64 - %arrayidx3 = getelementptr inbounds i32* %A, i64 %idxprom2 - %0 = load i32* %arrayidx3, align 4 +; CHECK: da analyze - consistent output [0|<]! ; CHECK: da analyze - consistent flow [2]! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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* %A, i64 %0 + %1 = trunc i64 %indvars.iv to i32 + store i32 %1, i32* %arrayidx, align 4 + %arrayidx3 = getelementptr inbounds i32* %A, i64 %indvars.iv + %2 = load i32* %arrayidx3, align 4 %incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1 - store i32 %0, i32* %B.addr.02, align 4 - %inc = add nsw i32 %i.03, 1 - %conv = sext i32 %inc to i64 - %cmp = icmp slt i64 %conv, %n - br i1 %cmp, label %for.body, label %for.end + 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.body, %entry +for.end: ; preds = %for.end.loopexit, %entry ret void } -;;void p7(unsigned *A, unsigned *B, char n) -;; A[n] = ... -;; ... = A[n + 1]; +;;void p7(unsigned *A, unsigned *B, char n) { +;; A[n] = 0; +;; *B = A[n + 1]; define void @p7(i32* %A, i32* %B, i8 signext %n) nounwind uwtable ssp { entry: %idxprom = sext i8 %n to i64 %arrayidx = getelementptr inbounds i32* %A, i64 %idxprom + +; CHECK: da analyze - consistent output! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + store i32 0, i32* %arrayidx, align 4 %conv = sext i8 %n to i64 %add = add i64 %conv, 1 %arrayidx2 = getelementptr inbounds i32* %A, i64 %add %0 = load i32* %arrayidx2, align 4 -; CHECK: da analyze - none! store i32 %0, i32* %B, align 4 ret void } - -;;void p8(unsigned *A, unsigned *B, short n) -;; A[n] = ... -;; ... = A[n + 1]; +;;void p8(unsigned *A, unsigned *B, short n) { +;; A[n] = 0; +;; *B = A[n + 1]; define void @p8(i32* %A, i32* %B, i16 signext %n) nounwind uwtable ssp { entry: %idxprom = sext i16 %n to i64 %arrayidx = getelementptr inbounds i32* %A, i64 %idxprom store i32 0, i32* %arrayidx, align 4 + +; CHECK: da analyze - consistent output! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + %conv = sext i16 %n to i64 %add = add i64 %conv, 1 %arrayidx2 = getelementptr inbounds i32* %A, i64 %add %0 = load i32* %arrayidx2, align 4 -; CHECK: da analyze - none! store i32 %0, i32* %B, align 4 ret void } -;;void p9(unsigned *A, unsigned *B, int n) -;; A[n] = ... -;; ... = A[n + 1]; +;;void p9(unsigned *A, unsigned *B, int n) { +;; A[n] = 0; +;; *B = A[n + 1]; define void @p9(i32* %A, i32* %B, i32 %n) nounwind uwtable ssp { entry: %idxprom = sext i32 %n to i64 %arrayidx = getelementptr inbounds i32* %A, i64 %idxprom store i32 0, i32* %arrayidx, align 4 + +; CHECK: da analyze - consistent output! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + %add = add nsw i32 %n, 1 %idxprom1 = sext i32 %add to i64 %arrayidx2 = getelementptr inbounds i32* %A, i64 %idxprom1 %0 = load i32* %arrayidx2, align 4 -; CHECK: da analyze - none! store i32 %0, i32* %B, align 4 ret void } -;;void p10(unsigned *A, unsigned *B, unsigned n) -;; A[n] = ... -;; ... = A[n + 1]; +;;void p10(unsigned *A, unsigned *B, unsigned n) { +;; A[n] = 0; +;; *B = A[n + 1]; define void @p10(i32* %A, i32* %B, i32 %n) nounwind uwtable ssp { entry: %idxprom = zext i32 %n to i64 %arrayidx = getelementptr inbounds i32* %A, i64 %idxprom store i32 0, i32* %arrayidx, align 4 + +; CHECK: da analyze - consistent output! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + %add = add i32 %n, 1 %idxprom1 = zext i32 %add to i64 %arrayidx2 = getelementptr inbounds i32* %A, i64 %idxprom1 %0 = load i32* %arrayidx2, align 4 -; CHECK: da analyze - none! store i32 %0, i32* %B, align 4 ret void } diff --git a/llvm/test/Analysis/DependenceAnalysis/Propagating.ll b/llvm/test/Analysis/DependenceAnalysis/Propagating.ll index 076348c..7a7219d 100644 --- a/llvm/test/Analysis/DependenceAnalysis/Propagating.ll +++ b/llvm/test/Analysis/DependenceAnalysis/Propagating.ll @@ -6,7 +6,7 @@ target triple = "x86_64-apple-macosx10.6.0" ;; for (long int i = 0; i < 100; i++) -;; for (long int j = 0; j < 100; j++) +;; for (long int j = 0; j < 100; j++) { ;; A[i + 1][i + j] = i; ;; *B++ = A[i][i + j]; @@ -14,12 +14,19 @@ define void @prop0([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp { entry: br label %for.cond1.preheader -for.cond1.preheader: ; preds = %for.inc9, %entry - %B.addr.04 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.inc9 ] +; CHECK: da analyze - consistent output [0 0|<]! +; CHECK: da analyze - consistent flow [1 -1]! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0 0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +for.cond1.preheader: ; preds = %entry, %for.inc9 + %B.addr.04 = phi i32* [ %B, %entry ], [ %scevgep, %for.inc9 ] %i.03 = phi i64 [ 0, %entry ], [ %inc10, %for.inc9 ] br label %for.body3 -for.body3: ; preds = %for.body3, %for.cond1.preheader +for.body3: ; preds = %for.cond1.preheader, %for.body3 %j.02 = phi i64 [ 0, %for.cond1.preheader ], [ %inc, %for.body3 ] %B.addr.11 = phi i32* [ %B.addr.04, %for.cond1.preheader ], [ %incdec.ptr, %for.body3 ] %conv = trunc i64 %i.03 to i32 @@ -30,17 +37,17 @@ for.body3: ; preds = %for.body3, %for.con %add6 = add nsw i64 %i.03, %j.02 %arrayidx8 = getelementptr inbounds [100 x i32]* %A, i64 %i.03, i64 %add6 %0 = load i32* %arrayidx8, align 4 -; CHECK: da analyze - consistent flow [1 -1]! %incdec.ptr = getelementptr inbounds i32* %B.addr.11, i64 1 store i32 %0, i32* %B.addr.11, align 4 %inc = add nsw i64 %j.02, 1 - %cmp2 = icmp slt i64 %inc, 100 - br i1 %cmp2, label %for.body3, label %for.inc9 + %exitcond = icmp ne i64 %inc, 100 + br i1 %exitcond, label %for.body3, label %for.inc9 for.inc9: ; preds = %for.body3 + %scevgep = getelementptr i32* %B.addr.04, i64 100 %inc10 = add nsw i64 %i.03, 1 - %cmp = icmp slt i64 %inc10, 100 - br i1 %cmp, label %for.cond1.preheader, label %for.end11 + %exitcond5 = icmp ne i64 %inc10, 100 + br i1 %exitcond5, label %for.cond1.preheader, label %for.end11 for.end11: ; preds = %for.inc9 ret void @@ -49,25 +56,32 @@ for.end11: ; preds = %for.inc9 ;; for (long int i = 0; i < 100; i++) ;; for (long int j = 0; j < 100; j++) -;; for (long int k = 0; k < 100; k++) -;; A[j - i][i + 1][j + k] = ... -;; ... = A[j - i][i][j + k]; +;; for (long int k = 0; k < 100; k++) { +;; A[j - i][i + 1][j + k] = i; +;; *B++ = A[j - i][i][j + k]; define void @prop1([100 x [100 x i32]]* %A, i32* %B, i32 %n) nounwind uwtable ssp { entry: br label %for.cond1.preheader -for.cond1.preheader: ; preds = %for.inc18, %entry - %B.addr.06 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.inc18 ] +; CHECK: da analyze - consistent output [0 0 0|<]! +; CHECK: da analyze - consistent flow [1 1 -1]! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0 0 0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +for.cond1.preheader: ; preds = %entry, %for.inc18 + %B.addr.06 = phi i32* [ %B, %entry ], [ %scevgep7, %for.inc18 ] %i.05 = phi i64 [ 0, %entry ], [ %inc19, %for.inc18 ] br label %for.cond4.preheader -for.cond4.preheader: ; preds = %for.inc15, %for.cond1.preheader - %B.addr.14 = phi i32* [ %B.addr.06, %for.cond1.preheader ], [ %incdec.ptr, %for.inc15 ] +for.cond4.preheader: ; preds = %for.cond1.preheader, %for.inc15 + %B.addr.14 = phi i32* [ %B.addr.06, %for.cond1.preheader ], [ %scevgep, %for.inc15 ] %j.03 = phi i64 [ 0, %for.cond1.preheader ], [ %inc16, %for.inc15 ] br label %for.body6 -for.body6: ; preds = %for.body6, %for.cond4.preheader +for.body6: ; preds = %for.cond4.preheader, %for.body6 %k.02 = phi i64 [ 0, %for.cond4.preheader ], [ %inc, %for.body6 ] %B.addr.21 = phi i32* [ %B.addr.14, %for.cond4.preheader ], [ %incdec.ptr, %for.body6 ] %conv = trunc i64 %i.05 to i32 @@ -80,22 +94,23 @@ for.body6: ; preds = %for.body6, %for.con %sub11 = sub nsw i64 %j.03, %i.05 %arrayidx14 = getelementptr inbounds [100 x [100 x i32]]* %A, i64 %sub11, i64 %i.05, i64 %add10 %0 = load i32* %arrayidx14, align 4 -; CHECK: da analyze - consistent flow [1 1 -1]! %incdec.ptr = getelementptr inbounds i32* %B.addr.21, i64 1 store i32 %0, i32* %B.addr.21, align 4 %inc = add nsw i64 %k.02, 1 - %cmp5 = icmp slt i64 %inc, 100 - br i1 %cmp5, label %for.body6, label %for.inc15 + %exitcond = icmp ne i64 %inc, 100 + br i1 %exitcond, label %for.body6, label %for.inc15 for.inc15: ; preds = %for.body6 + %scevgep = getelementptr i32* %B.addr.14, i64 100 %inc16 = add nsw i64 %j.03, 1 - %cmp2 = icmp slt i64 %inc16, 100 - br i1 %cmp2, label %for.cond4.preheader, label %for.inc18 + %exitcond8 = icmp ne i64 %inc16, 100 + br i1 %exitcond8, label %for.cond4.preheader, label %for.inc18 for.inc18: ; preds = %for.inc15 + %scevgep7 = getelementptr i32* %B.addr.06, i64 10000 %inc19 = add nsw i64 %i.05, 1 - %cmp = icmp slt i64 %inc19, 100 - br i1 %cmp, label %for.cond1.preheader, label %for.end20 + %exitcond9 = icmp ne i64 %inc19, 100 + br i1 %exitcond9, label %for.cond1.preheader, label %for.end20 for.end20: ; preds = %for.inc18 ret void @@ -103,20 +118,27 @@ for.end20: ; preds = %for.inc18 ;; for (long int i = 0; i < 100; i++) -;; for (long int j = 0; j < 100; j++) -;; A[i - 1][2*i] = ... -;; ... = A[i][i + j + 110]; +;; for (long int j = 0; j < 100; j++) { +;; A[i - 1][2*i] = i; +;; *B++ = A[i][i + j + 110]; define void @prop2([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp { entry: br label %for.cond1.preheader -for.cond1.preheader: ; preds = %for.inc8, %entry - %B.addr.04 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.inc8 ] +; CHECK: da analyze - consistent output [0 S|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0 0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +for.cond1.preheader: ; preds = %entry, %for.inc8 + %B.addr.04 = phi i32* [ %B, %entry ], [ %scevgep, %for.inc8 ] %i.03 = phi i64 [ 0, %entry ], [ %inc9, %for.inc8 ] br label %for.body3 -for.body3: ; preds = %for.body3, %for.cond1.preheader +for.body3: ; preds = %for.cond1.preheader, %for.body3 %j.02 = phi i64 [ 0, %for.cond1.preheader ], [ %inc, %for.body3 ] %B.addr.11 = phi i32* [ %B.addr.04, %for.cond1.preheader ], [ %incdec.ptr, %for.body3 ] %conv = trunc i64 %i.03 to i32 @@ -128,17 +150,17 @@ for.body3: ; preds = %for.body3, %for.con %add5 = add nsw i64 %add, 110 %arrayidx7 = getelementptr inbounds [100 x i32]* %A, i64 %i.03, i64 %add5 %0 = load i32* %arrayidx7, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.11, i64 1 store i32 %0, i32* %B.addr.11, align 4 %inc = add nsw i64 %j.02, 1 - %cmp2 = icmp slt i64 %inc, 100 - br i1 %cmp2, label %for.body3, label %for.inc8 + %exitcond = icmp ne i64 %inc, 100 + br i1 %exitcond, label %for.body3, label %for.inc8 for.inc8: ; preds = %for.body3 + %scevgep = getelementptr i32* %B.addr.04, i64 100 %inc9 = add nsw i64 %i.03, 1 - %cmp = icmp slt i64 %inc9, 100 - br i1 %cmp, label %for.cond1.preheader, label %for.end10 + %exitcond5 = icmp ne i64 %inc9, 100 + br i1 %exitcond5, label %for.cond1.preheader, label %for.end10 for.end10: ; preds = %for.inc8 ret void @@ -146,20 +168,27 @@ for.end10: ; preds = %for.inc8 ;; for (long int i = 0; i < 100; i++) -;; for (long int j = 0; j < 100; j++) -;; A[i][2*j + i] = ... -;; ... = A[i][2*j - i + 5]; +;; for (long int j = 0; j < 100; j++) { +;; A[i][2*j + i] = i; +;; *B++ = A[i][2*j - i + 5]; define void @prop3([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp { entry: br label %for.cond1.preheader -for.cond1.preheader: ; preds = %for.inc9, %entry - %B.addr.04 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.inc9 ] +; CHECK: da analyze - consistent output [0 0|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0 0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +for.cond1.preheader: ; preds = %entry, %for.inc9 + %B.addr.04 = phi i32* [ %B, %entry ], [ %scevgep, %for.inc9 ] %i.03 = phi i64 [ 0, %entry ], [ %inc10, %for.inc9 ] br label %for.body3 -for.body3: ; preds = %for.body3, %for.cond1.preheader +for.body3: ; preds = %for.cond1.preheader, %for.body3 %j.02 = phi i64 [ 0, %for.cond1.preheader ], [ %inc, %for.body3 ] %B.addr.11 = phi i32* [ %B.addr.04, %for.cond1.preheader ], [ %incdec.ptr, %for.body3 ] %conv = trunc i64 %i.03 to i32 @@ -172,39 +201,45 @@ for.body3: ; preds = %for.body3, %for.con %add6 = add nsw i64 %sub, 5 %arrayidx8 = getelementptr inbounds [100 x i32]* %A, i64 %i.03, i64 %add6 %0 = load i32* %arrayidx8, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.11, i64 1 store i32 %0, i32* %B.addr.11, align 4 %inc = add nsw i64 %j.02, 1 - %cmp2 = icmp slt i64 %inc, 100 - br i1 %cmp2, label %for.body3, label %for.inc9 + %exitcond = icmp ne i64 %inc, 100 + br i1 %exitcond, label %for.body3, label %for.inc9 for.inc9: ; preds = %for.body3 + %scevgep = getelementptr i32* %B.addr.04, i64 100 %inc10 = add nsw i64 %i.03, 1 - %cmp = icmp slt i64 %inc10, 100 - br i1 %cmp, label %for.cond1.preheader, label %for.end11 + %exitcond5 = icmp ne i64 %inc10, 100 + br i1 %exitcond5, label %for.cond1.preheader, label %for.end11 for.end11: ; preds = %for.inc9 ret void } -;; propagate Distance ;; for (long int i = 0; i < 100; i++) -;; for (long int j = 0; j < 100; j++) -;; A[i + 2][2*i + j + 1] = ... -;; ... = A[i][2*i + j]; +;; for (long int j = 0; j < 100; j++) { +;; A[i + 2][2*i + j + 1] = i; +;; *B++ = A[i][2*i + j]; define void @prop4([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp { entry: br label %for.cond1.preheader -for.cond1.preheader: ; preds = %for.inc11, %entry - %B.addr.04 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.inc11 ] +; CHECK: da analyze - consistent output [0 0|<]! +; CHECK: da analyze - consistent flow [2 -3]! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0 0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +for.cond1.preheader: ; preds = %entry, %for.inc11 + %B.addr.04 = phi i32* [ %B, %entry ], [ %scevgep, %for.inc11 ] %i.03 = phi i64 [ 0, %entry ], [ %inc12, %for.inc11 ] br label %for.body3 -for.body3: ; preds = %for.body3, %for.cond1.preheader +for.body3: ; preds = %for.cond1.preheader, %for.body3 %j.02 = phi i64 [ 0, %for.cond1.preheader ], [ %inc, %for.body3 ] %B.addr.11 = phi i32* [ %B.addr.04, %for.cond1.preheader ], [ %incdec.ptr, %for.body3 ] %conv = trunc i64 %i.03 to i32 @@ -218,39 +253,46 @@ for.body3: ; preds = %for.body3, %for.con %add8 = add nsw i64 %mul7, %j.02 %arrayidx10 = getelementptr inbounds [100 x i32]* %A, i64 %i.03, i64 %add8 %0 = load i32* %arrayidx10, align 4 -; CHECK: da analyze - consistent flow [2 -3]! %incdec.ptr = getelementptr inbounds i32* %B.addr.11, i64 1 store i32 %0, i32* %B.addr.11, align 4 %inc = add nsw i64 %j.02, 1 - %cmp2 = icmp slt i64 %inc, 100 - br i1 %cmp2, label %for.body3, label %for.inc11 + %exitcond = icmp ne i64 %inc, 100 + br i1 %exitcond, label %for.body3, label %for.inc11 for.inc11: ; preds = %for.body3 + %scevgep = getelementptr i32* %B.addr.04, i64 100 %inc12 = add nsw i64 %i.03, 1 - %cmp = icmp slt i64 %inc12, 100 - br i1 %cmp, label %for.cond1.preheader, label %for.end13 + %exitcond5 = icmp ne i64 %inc12, 100 + br i1 %exitcond5, label %for.cond1.preheader, label %for.end13 for.end13: ; preds = %for.inc11 ret void } -;; propagate Point ;; for (long int i = 0; i < 100; i++) -;; for (long int j = 0; j < 100; j++) -;; A[3*i - 18][22 - i][2*i + j] = ... -;; ... = A[i][i][3*i + j]; +;; for (long int j = 0; j < 100; j++) { +;; A[3*i - 18][22 - i][2*i + j] = i; +;; *B++ = A[i][i][3*i + j]; define void @prop5([100 x [100 x i32]]* %A, i32* %B, i32 %n) nounwind uwtable ssp { entry: br label %for.cond1.preheader -for.cond1.preheader: ; preds = %for.inc13, %entry - %B.addr.04 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.inc13 ] +; CHECK: da analyze - consistent output [0 0|<]! +; CHECK: da analyze - flow [< -16] splitable! +; CHECK: da analyze - split level = 1, iteration = 11! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0 0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +for.cond1.preheader: ; preds = %entry, %for.inc13 + %B.addr.04 = phi i32* [ %B, %entry ], [ %scevgep, %for.inc13 ] %i.03 = phi i64 [ 0, %entry ], [ %inc14, %for.inc13 ] br label %for.body3 -for.body3: ; preds = %for.body3, %for.cond1.preheader +for.body3: ; preds = %for.cond1.preheader, %for.body3 %j.02 = phi i64 [ 0, %for.cond1.preheader ], [ %inc, %for.body3 ] %B.addr.11 = phi i32* [ %B.addr.04, %for.cond1.preheader ], [ %incdec.ptr, %for.body3 ] %conv = trunc i64 %i.03 to i32 @@ -265,40 +307,45 @@ for.body3: ; preds = %for.body3, %for.con %add9 = add nsw i64 %mul8, %j.02 %arrayidx12 = getelementptr inbounds [100 x [100 x i32]]* %A, i64 %i.03, i64 %i.03, i64 %add9 %0 = load i32* %arrayidx12, align 4 -; CHECK: da analyze - flow [< -16] splitable! -; CHECK: da analyze - split level = 1, iteration = 11! %incdec.ptr = getelementptr inbounds i32* %B.addr.11, i64 1 store i32 %0, i32* %B.addr.11, align 4 %inc = add nsw i64 %j.02, 1 - %cmp2 = icmp slt i64 %inc, 100 - br i1 %cmp2, label %for.body3, label %for.inc13 + %exitcond = icmp ne i64 %inc, 100 + br i1 %exitcond, label %for.body3, label %for.inc13 for.inc13: ; preds = %for.body3 + %scevgep = getelementptr i32* %B.addr.04, i64 100 %inc14 = add nsw i64 %i.03, 1 - %cmp = icmp slt i64 %inc14, 100 - br i1 %cmp, label %for.cond1.preheader, label %for.end15 + %exitcond5 = icmp ne i64 %inc14, 100 + br i1 %exitcond5, label %for.cond1.preheader, label %for.end15 for.end15: ; preds = %for.inc13 ret void } -;; propagate Line ;; for (long int i = 0; i < 100; i++) -;; for (long int j = 0; j < 100; j++) -;; A[i + 1][4*i + j + 2] = ... -;; ... = A[2*i][8*i + j]; +;; for (long int j = 0; j < 100; j++) { +;; A[i + 1][4*i + j + 2] = i; +;; *B++ = A[2*i][8*i + j]; define void @prop6([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp { entry: br label %for.cond1.preheader -for.cond1.preheader: ; preds = %for.inc12, %entry - %B.addr.04 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.inc12 ] +; CHECK: da analyze - consistent output [0 0|<]! +; CHECK: da analyze - flow [=> -2]! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0 0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +for.cond1.preheader: ; preds = %entry, %for.inc12 + %B.addr.04 = phi i32* [ %B, %entry ], [ %scevgep, %for.inc12 ] %i.03 = phi i64 [ 0, %entry ], [ %inc13, %for.inc12 ] br label %for.body3 -for.body3: ; preds = %for.body3, %for.cond1.preheader +for.body3: ; preds = %for.cond1.preheader, %for.body3 %j.02 = phi i64 [ 0, %for.cond1.preheader ], [ %inc, %for.body3 ] %B.addr.11 = phi i32* [ %B.addr.04, %for.cond1.preheader ], [ %incdec.ptr, %for.body3 ] %conv = trunc i64 %i.03 to i32 @@ -313,17 +360,17 @@ for.body3: ; preds = %for.body3, %for.con %mul9 = shl nsw i64 %i.03, 1 %arrayidx11 = getelementptr inbounds [100 x i32]* %A, i64 %mul9, i64 %add8 %0 = load i32* %arrayidx11, align 4 -; CHECK: da analyze - flow [=> -2]! %incdec.ptr = getelementptr inbounds i32* %B.addr.11, i64 1 store i32 %0, i32* %B.addr.11, align 4 %inc = add nsw i64 %j.02, 1 - %cmp2 = icmp slt i64 %inc, 100 - br i1 %cmp2, label %for.body3, label %for.inc12 + %exitcond = icmp ne i64 %inc, 100 + br i1 %exitcond, label %for.body3, label %for.inc12 for.inc12: ; preds = %for.body3 + %scevgep = getelementptr i32* %B.addr.04, i64 100 %inc13 = add nsw i64 %i.03, 1 - %cmp = icmp slt i64 %inc13, 100 - br i1 %cmp, label %for.cond1.preheader, label %for.end14 + %exitcond5 = icmp ne i64 %inc13, 100 + br i1 %exitcond5, label %for.cond1.preheader, label %for.end14 for.end14: ; preds = %for.inc12 ret void @@ -331,20 +378,28 @@ for.end14: ; preds = %for.inc12 ;; for (long int i = 0; i < 100; i++) -;; for (long int j = 0; j < 100; j++) -;; A[2*i + 4][-5*i + j + 2] = ... -;; ... = A[-2*i + 20][5*i + j]; +;; for (long int j = 0; j < 100; j++) { +;; A[2*i + 4][-5*i + j + 2] = i; +;; *B++ = A[-2*i + 20][5*i + j]; define void @prop7([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp { entry: br label %for.cond1.preheader -for.cond1.preheader: ; preds = %for.inc14, %entry - %B.addr.04 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.inc14 ] +; CHECK: da analyze - consistent output [0 0|<]! +; CHECK: da analyze - flow [* -38] splitable! +; CHECK: da analyze - split level = 1, iteration = 4! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0 0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +for.cond1.preheader: ; preds = %entry, %for.inc14 + %B.addr.04 = phi i32* [ %B, %entry ], [ %scevgep, %for.inc14 ] %i.03 = phi i64 [ 0, %entry ], [ %inc15, %for.inc14 ] br label %for.body3 -for.body3: ; preds = %for.body3, %for.cond1.preheader +for.body3: ; preds = %for.cond1.preheader, %for.body3 %j.02 = phi i64 [ 0, %for.cond1.preheader ], [ %inc, %for.body3 ] %B.addr.11 = phi i32* [ %B.addr.04, %for.cond1.preheader ], [ %incdec.ptr, %for.body3 ] %conv = trunc i64 %i.03 to i32 @@ -361,18 +416,17 @@ for.body3: ; preds = %for.body3, %for.con %add11 = add nsw i64 %mul10, 20 %arrayidx13 = getelementptr inbounds [100 x i32]* %A, i64 %add11, i64 %add9 %0 = load i32* %arrayidx13, align 4 -; CHECK: da analyze - flow [* -38] splitable! -; CHECK: da analyze - split level = 1, iteration = 4! %incdec.ptr = getelementptr inbounds i32* %B.addr.11, i64 1 store i32 %0, i32* %B.addr.11, align 4 %inc = add nsw i64 %j.02, 1 - %cmp2 = icmp slt i64 %inc, 100 - br i1 %cmp2, label %for.body3, label %for.inc14 + %exitcond = icmp ne i64 %inc, 100 + br i1 %exitcond, label %for.body3, label %for.inc14 for.inc14: ; preds = %for.body3 + %scevgep = getelementptr i32* %B.addr.04, i64 100 %inc15 = add nsw i64 %i.03, 1 - %cmp = icmp slt i64 %inc15, 100 - br i1 %cmp, label %for.cond1.preheader, label %for.end16 + %exitcond5 = icmp ne i64 %inc15, 100 + br i1 %exitcond5, label %for.cond1.preheader, label %for.end16 for.end16: ; preds = %for.inc14 ret void @@ -380,20 +434,27 @@ for.end16: ; preds = %for.inc14 ;; for (long int i = 0; i < 100; i++) -;; for (long int j = 0; j < 100; j++) -;; A[4][j + 2] = ... -;; ... = A[-2*i + 4][5*i + j]; +;; for (long int j = 0; j < 100; j++) { +;; A[4][j + 2] = i; +;; *B++ = A[-2*i + 4][5*i + j]; define void @prop8([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp { entry: br label %for.cond1.preheader -for.cond1.preheader: ; preds = %for.inc10, %entry - %B.addr.04 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.inc10 ] +; CHECK: da analyze - consistent output [S 0|<]! +; CHECK: da analyze - flow [p<= 2]! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0 0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +for.cond1.preheader: ; preds = %entry, %for.inc10 + %B.addr.04 = phi i32* [ %B, %entry ], [ %scevgep, %for.inc10 ] %i.03 = phi i64 [ 0, %entry ], [ %inc11, %for.inc10 ] br label %for.body3 -for.body3: ; preds = %for.body3, %for.cond1.preheader +for.body3: ; preds = %for.cond1.preheader, %for.body3 %j.02 = phi i64 [ 0, %for.cond1.preheader ], [ %inc, %for.body3 ] %B.addr.11 = phi i32* [ %B.addr.04, %for.cond1.preheader ], [ %incdec.ptr, %for.body3 ] %conv = trunc i64 %i.03 to i32 @@ -406,17 +467,17 @@ for.body3: ; preds = %for.body3, %for.con %add7 = add nsw i64 %mul6, 4 %arrayidx9 = getelementptr inbounds [100 x i32]* %A, i64 %add7, i64 %add5 %0 = load i32* %arrayidx9, align 4 -; CHECK: da analyze - flow [p<= 2]! %incdec.ptr = getelementptr inbounds i32* %B.addr.11, i64 1 store i32 %0, i32* %B.addr.11, align 4 %inc = add nsw i64 %j.02, 1 - %cmp2 = icmp slt i64 %inc, 100 - br i1 %cmp2, label %for.body3, label %for.inc10 + %exitcond = icmp ne i64 %inc, 100 + br i1 %exitcond, label %for.body3, label %for.inc10 for.inc10: ; preds = %for.body3 + %scevgep = getelementptr i32* %B.addr.04, i64 100 %inc11 = add nsw i64 %i.03, 1 - %cmp = icmp slt i64 %inc11, 100 - br i1 %cmp, label %for.cond1.preheader, label %for.end12 + %exitcond5 = icmp ne i64 %inc11, 100 + br i1 %exitcond5, label %for.cond1.preheader, label %for.end12 for.end12: ; preds = %for.inc10 ret void @@ -424,20 +485,27 @@ for.end12: ; preds = %for.inc10 ;; for (long int i = 0; i < 100; i++) -;; for (long int j = 0; j < 100; j++) -;; A[2*i + 4][5*i + j + 2] = ... -;; ... = A[4][j]; +;; for (long int j = 0; j < 100; j++) { +;; A[2*i + 4][5*i + j + 2] = i; +;; *B++ = A[4][j]; define void @prop9([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp { entry: br label %for.cond1.preheader -for.cond1.preheader: ; preds = %for.inc10, %entry - %B.addr.04 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.inc10 ] +; CHECK: da analyze - consistent output [0 0|<]! +; CHECK: da analyze - flow [p<= 2]! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [S 0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +for.cond1.preheader: ; preds = %entry, %for.inc10 + %B.addr.04 = phi i32* [ %B, %entry ], [ %scevgep, %for.inc10 ] %i.03 = phi i64 [ 0, %entry ], [ %inc11, %for.inc10 ] br label %for.body3 -for.body3: ; preds = %for.body3, %for.cond1.preheader +for.body3: ; preds = %for.cond1.preheader, %for.body3 %j.02 = phi i64 [ 0, %for.cond1.preheader ], [ %inc, %for.body3 ] %B.addr.11 = phi i32* [ %B.addr.04, %for.cond1.preheader ], [ %incdec.ptr, %for.body3 ] %conv = trunc i64 %i.03 to i32 @@ -450,17 +518,17 @@ for.body3: ; preds = %for.body3, %for.con store i32 %conv, i32* %arrayidx7, align 4 %arrayidx9 = getelementptr inbounds [100 x i32]* %A, i64 4, i64 %j.02 %0 = load i32* %arrayidx9, align 4 -; CHECK: da analyze - flow [p<= 2]! %incdec.ptr = getelementptr inbounds i32* %B.addr.11, i64 1 store i32 %0, i32* %B.addr.11, align 4 %inc = add nsw i64 %j.02, 1 - %cmp2 = icmp slt i64 %inc, 100 - br i1 %cmp2, label %for.body3, label %for.inc10 + %exitcond = icmp ne i64 %inc, 100 + br i1 %exitcond, label %for.body3, label %for.inc10 for.inc10: ; preds = %for.body3 + %scevgep = getelementptr i32* %B.addr.04, i64 100 %inc11 = add nsw i64 %i.03, 1 - %cmp = icmp slt i64 %inc11, 100 - br i1 %cmp, label %for.cond1.preheader, label %for.end12 + %exitcond5 = icmp ne i64 %inc11, 100 + br i1 %exitcond5, label %for.cond1.preheader, label %for.end12 for.end12: ; preds = %for.inc10 ret void diff --git a/llvm/test/Analysis/DependenceAnalysis/Separability.ll b/llvm/test/Analysis/DependenceAnalysis/Separability.ll index d42d3cd..aaa1060 100644 --- a/llvm/test/Analysis/DependenceAnalysis/Separability.ll +++ b/llvm/test/Analysis/DependenceAnalysis/Separability.ll @@ -8,30 +8,37 @@ 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] = ... -;; ... = A[10][i + 10][2*j - l]; +;; 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 -for.cond1.preheader: ; preds = %for.inc22, %entry - %B.addr.08 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.inc22 ] +; 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 - confused! + +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.inc19, %for.cond1.preheader - %B.addr.16 = phi i32* [ %B.addr.08, %for.cond1.preheader ], [ %incdec.ptr, %for.inc19 ] +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.inc16, %for.cond4.preheader - %B.addr.24 = phi i32* [ %B.addr.16, %for.cond4.preheader ], [ %incdec.ptr, %for.inc16 ] +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.body9, %for.cond7.preheader +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 @@ -44,27 +51,29 @@ for.body9: ; preds = %for.body9, %for.con %add12 = add nsw i64 %i.07, 10 %arrayidx15 = getelementptr inbounds [100 x [100 x i32]]* %A, i64 10, i64 %add12, i64 %sub %0 = load i32* %arrayidx15, align 4 -; CHECK: da analyze - flow [-10 * * *]! %incdec.ptr = getelementptr inbounds i32* %B.addr.31, i64 1 store i32 %0, i32* %B.addr.31, align 4 %inc = add nsw i64 %l.02, 1 - %cmp8 = icmp slt i64 %inc, 50 - br i1 %cmp8, label %for.body9, label %for.inc16 + %exitcond = icmp ne i64 %inc, 50 + br i1 %exitcond, label %for.body9, label %for.inc16 for.inc16: ; preds = %for.body9 + %scevgep = getelementptr i32* %B.addr.24, i64 50 %inc17 = add nsw i64 %k.03, 1 - %cmp5 = icmp slt i64 %inc17, 50 - br i1 %cmp5, label %for.cond7.preheader, label %for.inc19 + %exitcond10 = icmp ne i64 %inc17, 50 + br i1 %exitcond10, label %for.cond7.preheader, label %for.inc19 for.inc19: ; preds = %for.inc16 + %scevgep9 = getelementptr i32* %B.addr.16, i64 2500 %inc20 = add nsw i64 %j.05, 1 - %cmp2 = icmp slt i64 %inc20, 50 - br i1 %cmp2, label %for.cond4.preheader, label %for.inc22 + %exitcond12 = icmp ne i64 %inc20, 50 + br i1 %exitcond12, label %for.cond4.preheader, label %for.inc22 for.inc22: ; preds = %for.inc19 + %scevgep11 = getelementptr i32* %B.addr.08, i64 125000 %inc23 = add nsw i64 %i.07, 1 - %cmp = icmp slt i64 %inc23, 50 - br i1 %cmp, label %for.cond1.preheader, label %for.end24 + %exitcond13 = icmp ne i64 %inc23, 50 + br i1 %exitcond13, label %for.cond1.preheader, label %for.end24 for.end24: ; preds = %for.inc22 ret void @@ -74,30 +83,37 @@ for.end24: ; preds = %for.inc22 ;; 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] = ... -;; ... = A[10][i + 10][2*j - l]; +;; 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 -for.cond1.preheader: ; preds = %for.inc22, %entry - %B.addr.08 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.inc22 ] +; 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 - confused! + +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.inc19, %for.cond1.preheader - %B.addr.16 = phi i32* [ %B.addr.08, %for.cond1.preheader ], [ %incdec.ptr, %for.inc19 ] +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.inc16, %for.cond4.preheader - %B.addr.24 = phi i32* [ %B.addr.16, %for.cond4.preheader ], [ %incdec.ptr, %for.inc16 ] +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.body9, %for.cond7.preheader +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 @@ -109,27 +125,29 @@ for.body9: ; preds = %for.body9, %for.con %add12 = add nsw i64 %i.07, 10 %arrayidx15 = getelementptr inbounds [100 x [100 x i32]]* %A, i64 10, i64 %add12, i64 %sub %0 = load i32* %arrayidx15, align 4 -; CHECK: da analyze - flow [> * * *]! %incdec.ptr = getelementptr inbounds i32* %B.addr.31, i64 1 store i32 %0, i32* %B.addr.31, align 4 %inc = add nsw i64 %l.02, 1 - %cmp8 = icmp slt i64 %inc, 50 - br i1 %cmp8, label %for.body9, label %for.inc16 + %exitcond = icmp ne i64 %inc, 50 + br i1 %exitcond, label %for.body9, label %for.inc16 for.inc16: ; preds = %for.body9 + %scevgep = getelementptr i32* %B.addr.24, i64 50 %inc17 = add nsw i64 %k.03, 1 - %cmp5 = icmp slt i64 %inc17, 50 - br i1 %cmp5, label %for.cond7.preheader, label %for.inc19 + %exitcond10 = icmp ne i64 %inc17, 50 + br i1 %exitcond10, label %for.cond7.preheader, label %for.inc19 for.inc19: ; preds = %for.inc16 + %scevgep9 = getelementptr i32* %B.addr.16, i64 2500 %inc20 = add nsw i64 %j.05, 1 - %cmp2 = icmp slt i64 %inc20, 50 - br i1 %cmp2, label %for.cond4.preheader, label %for.inc22 + %exitcond12 = icmp ne i64 %inc20, 50 + br i1 %exitcond12, label %for.cond4.preheader, label %for.inc22 for.inc22: ; preds = %for.inc19 + %scevgep11 = getelementptr i32* %B.addr.08, i64 125000 %inc23 = add nsw i64 %i.07, 1 - %cmp = icmp slt i64 %inc23, 50 - br i1 %cmp, label %for.cond1.preheader, label %for.end24 + %exitcond13 = icmp ne i64 %inc23, 50 + br i1 %exitcond13, label %for.cond1.preheader, label %for.end24 for.end24: ; preds = %for.inc22 ret void @@ -139,30 +157,37 @@ for.end24: ; preds = %for.inc22 ;; 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] = ... -;; ... = A[10][i + 10][j + k][l + 10]; +;; 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 -for.cond1.preheader: ; preds = %for.inc26, %entry - %B.addr.08 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.inc26 ] +; 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 - confused! + +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.inc23, %for.cond1.preheader - %B.addr.16 = phi i32* [ %B.addr.08, %for.cond1.preheader ], [ %incdec.ptr, %for.inc23 ] +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.inc20, %for.cond4.preheader - %B.addr.24 = phi i32* [ %B.addr.16, %for.cond4.preheader ], [ %incdec.ptr, %for.inc20 ] +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.body9, %for.cond7.preheader +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 @@ -174,27 +199,29 @@ for.body9: ; preds = %for.body9, %for.con %add15 = add nsw i64 %i.07, 10 %arrayidx19 = getelementptr inbounds [100 x [100 x [100 x i32]]]* %A, i64 10, i64 %add15, i64 %add14, i64 %add13 %0 = load i32* %arrayidx19, align 4 -; CHECK: da analyze - flow [> * * -10]! %incdec.ptr = getelementptr inbounds i32* %B.addr.31, i64 1 store i32 %0, i32* %B.addr.31, align 4 %inc = add nsw i64 %l.02, 1 - %cmp8 = icmp slt i64 %inc, 50 - br i1 %cmp8, label %for.body9, label %for.inc20 + %exitcond = icmp ne i64 %inc, 50 + br i1 %exitcond, label %for.body9, label %for.inc20 for.inc20: ; preds = %for.body9 + %scevgep = getelementptr i32* %B.addr.24, i64 50 %inc21 = add nsw i64 %k.03, 1 - %cmp5 = icmp slt i64 %inc21, 50 - br i1 %cmp5, label %for.cond7.preheader, label %for.inc23 + %exitcond10 = icmp ne i64 %inc21, 50 + br i1 %exitcond10, label %for.cond7.preheader, label %for.inc23 for.inc23: ; preds = %for.inc20 + %scevgep9 = getelementptr i32* %B.addr.16, i64 2500 %inc24 = add nsw i64 %j.05, 1 - %cmp2 = icmp slt i64 %inc24, 50 - br i1 %cmp2, label %for.cond4.preheader, label %for.inc26 + %exitcond12 = icmp ne i64 %inc24, 50 + br i1 %exitcond12, label %for.cond4.preheader, label %for.inc26 for.inc26: ; preds = %for.inc23 + %scevgep11 = getelementptr i32* %B.addr.08, i64 125000 %inc27 = add nsw i64 %i.07, 1 - %cmp = icmp slt i64 %inc27, 50 - br i1 %cmp, label %for.cond1.preheader, label %for.end28 + %exitcond13 = icmp ne i64 %inc27, 50 + br i1 %exitcond13, label %for.cond1.preheader, label %for.end28 for.end28: ; preds = %for.inc26 ret void @@ -204,30 +231,37 @@ for.end28: ; preds = %for.inc26 ;; 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] = ... -;; ... = A[10][i + 10][j + k][l + 10]; +;; 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 -for.cond1.preheader: ; preds = %for.inc27, %entry - %B.addr.08 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.inc27 ] +; 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 - confused! + +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.inc24, %for.cond1.preheader - %B.addr.16 = phi i32* [ %B.addr.08, %for.cond1.preheader ], [ %incdec.ptr, %for.inc24 ] +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.inc21, %for.cond4.preheader - %B.addr.24 = phi i32* [ %B.addr.16, %for.cond4.preheader ], [ %incdec.ptr, %for.inc21 ] +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.body9, %for.cond7.preheader +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 @@ -240,27 +274,29 @@ for.body9: ; preds = %for.body9, %for.con %add16 = add nsw i64 %i.07, 10 %arrayidx20 = getelementptr inbounds [100 x [100 x [100 x i32]]]* %A, i64 10, i64 %add16, i64 %add15, i64 %add14 %0 = load i32* %arrayidx20, align 4 -; CHECK: da analyze - flow [> * * *]! %incdec.ptr = getelementptr inbounds i32* %B.addr.31, i64 1 store i32 %0, i32* %B.addr.31, align 4 %inc = add nsw i64 %l.02, 1 - %cmp8 = icmp slt i64 %inc, 50 - br i1 %cmp8, label %for.body9, label %for.inc21 + %exitcond = icmp ne i64 %inc, 50 + br i1 %exitcond, label %for.body9, label %for.inc21 for.inc21: ; preds = %for.body9 + %scevgep = getelementptr i32* %B.addr.24, i64 50 %inc22 = add nsw i64 %k.03, 1 - %cmp5 = icmp slt i64 %inc22, 50 - br i1 %cmp5, label %for.cond7.preheader, label %for.inc24 + %exitcond10 = icmp ne i64 %inc22, 50 + br i1 %exitcond10, label %for.cond7.preheader, label %for.inc24 for.inc24: ; preds = %for.inc21 + %scevgep9 = getelementptr i32* %B.addr.16, i64 2500 %inc25 = add nsw i64 %j.05, 1 - %cmp2 = icmp slt i64 %inc25, 50 - br i1 %cmp2, label %for.cond4.preheader, label %for.inc27 + %exitcond12 = icmp ne i64 %inc25, 50 + br i1 %exitcond12, label %for.cond4.preheader, label %for.inc27 for.inc27: ; preds = %for.inc24 + %scevgep11 = getelementptr i32* %B.addr.08, i64 125000 %inc28 = add nsw i64 %i.07, 1 - %cmp = icmp slt i64 %inc28, 50 - br i1 %cmp, label %for.cond1.preheader, label %for.end29 + %exitcond13 = icmp ne i64 %inc28, 50 + br i1 %exitcond13, label %for.cond1.preheader, label %for.end29 for.end29: ; preds = %for.inc27 ret void diff --git a/llvm/test/Analysis/DependenceAnalysis/StrongSIV.ll b/llvm/test/Analysis/DependenceAnalysis/StrongSIV.ll index be336c3..156d55f 100644 --- a/llvm/test/Analysis/DependenceAnalysis/StrongSIV.ll +++ b/llvm/test/Analysis/DependenceAnalysis/StrongSIV.ll @@ -1,143 +1,196 @@ -; RUN: opt < %s -analyze -basicaa -indvars -da | FileCheck %s +; 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] = ... -;; ... = A[i]; +;; 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, label %for.end - -for.body: ; preds = %for.body, %entry - %i.03 = phi i32 [ %inc, %for.body ], [ 0, %entry ] - %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ] - %add = add nsw i32 %i.03, 2 - %idxprom = sext i32 %add to i64 - %arrayidx = getelementptr inbounds i32* %A, i64 %idxprom - store i32 %i.03, i32* %arrayidx, align 4 - %idxprom2 = sext i32 %i.03 to i64 - %arrayidx3 = getelementptr inbounds i32* %A, i64 %idxprom2 - %0 = load i32* %arrayidx3, align 4 + br i1 %cmp1, label %for.body.preheader, label %for.end + +; CHECK: da analyze - consistent output [0|<]! ; CHECK: da analyze - consistent flow [2]! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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* %A, i64 %0 + %1 = trunc i64 %indvars.iv to i32 + store i32 %1, i32* %arrayidx, align 4 + %arrayidx3 = getelementptr inbounds i32* %A, i64 %indvars.iv + %2 = load i32* %arrayidx3, align 4 %incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1 - store i32 %0, i32* %B.addr.02, align 4 - %inc = add nsw i32 %i.03, 1 - %conv = sext i32 %inc to i64 - %cmp = icmp slt i64 %conv, %n - br i1 %cmp, label %for.body, label %for.end + 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.body, %entry +for.end: ; preds = %for.end.loopexit, %entry ret void } -;; for (long int i = 0; i < n; i++) -;; A[i + 2] = ... -;; ... = A[i]; +;; 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: - %conv = sext i32 %n to i64 %cmp1 = icmp sgt i32 %n, 0 - br i1 %cmp1, label %for.body, label %for.end + br i1 %cmp1, label %for.body.preheader, label %for.end -for.body: ; preds = %for.body, %entry - %i.03 = phi i64 [ %inc, %for.body ], [ 0, %entry ] - %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ] +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - consistent flow [2]! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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* %A, i64 %add store i32 %conv2, i32* %arrayidx, align 4 %arrayidx3 = getelementptr inbounds i32* %A, i64 %i.03 - %0 = load i32* %arrayidx3, align 4 -; CHECK: da analyze - consistent flow [2]! + %1 = load i32* %arrayidx3, align 4 %incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1 - store i32 %0, i32* %B.addr.02, align 4 + store i32 %1, i32* %B.addr.02, align 4 %inc = add nsw i64 %i.03, 1 - %cmp = icmp slt i64 %inc, %conv - br i1 %cmp, label %for.body, label %for.end + %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.body, %entry +for.end: ; preds = %for.end.loopexit, %entry ret void } -;; for (long unsigned i = 0; i < n; i++) -;; A[i + 2] = ... -;; ... = A[i]; +;; 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 + br i1 %cmp1, label %for.end, label %for.body.preheader + +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - consistent flow [2]! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! -for.body: ; preds = %for.body, %entry - %i.03 = phi i64 [ %inc, %for.body ], [ 0, %entry ] - %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ] +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* %A, i64 %add store i32 %conv, i32* %arrayidx, align 4 %arrayidx1 = getelementptr inbounds i32* %A, i64 %i.03 %0 = load i32* %arrayidx1, align 4 -; CHECK: da analyze - consistent flow [2]! %incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1 store i32 %0, i32* %B.addr.02, align 4 %inc = add i64 %i.03, 1 - %cmp = icmp ult i64 %inc, %n - br i1 %cmp, label %for.body, label %for.end + %exitcond = icmp ne i64 %inc, %n + br i1 %exitcond, label %for.body, label %for.end.loopexit -for.end: ; preds = %for.body, %entry +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] = ... -;; ... = A[i]; +;; 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, label %for.end - -for.body: ; preds = %for.body, %entry - %i.03 = phi i32 [ %inc, %for.body ], [ 0, %entry ] - %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ] - %add = add nsw i32 %i.03, 2 - %idxprom = sext i32 %add to i64 - %arrayidx = getelementptr inbounds i32* %A, i64 %idxprom - store i32 %i.03, i32* %arrayidx, align 4 - %idxprom1 = sext i32 %i.03 to i64 - %arrayidx2 = getelementptr inbounds i32* %A, i64 %idxprom1 - %0 = load i32* %arrayidx2, align 4 + br i1 %cmp1, label %for.body.preheader, label %for.end + +; CHECK: da analyze - consistent output [0|<]! ; CHECK: da analyze - consistent flow [2]! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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* %A, i64 %0 + %1 = trunc i64 %indvars.iv to i32 + store i32 %1, i32* %arrayidx, align 4 + %arrayidx2 = getelementptr inbounds i32* %A, i64 %indvars.iv + %2 = load i32* %arrayidx2, align 4 %incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1 - store i32 %0, i32* %B.addr.02, align 4 - %inc = add nsw i32 %i.03, 1 - %cmp = icmp slt i32 %inc, %n - br i1 %cmp, label %for.body, label %for.end + 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.body, %entry +for.end: ; preds = %for.end.loopexit, %entry ret void } -;; for (long unsigned i = 0; i < 19; i++) -;; A[i + 19] = ... -;; ... = A[i]; +;; 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 -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -146,27 +199,33 @@ for.body: ; preds = %for.body, %entry store i32 %conv, i32* %arrayidx, align 4 %arrayidx1 = getelementptr inbounds i32* %A, i64 %i.02 %0 = load i32* %arrayidx1, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add i64 %i.02, 1 - %cmp = icmp ult i64 %inc, 19 - br i1 %cmp, label %for.body, label %for.end + %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] = ... -;; ... = A[i]; +;; 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 -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - consistent flow [19]! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -175,27 +234,33 @@ for.body: ; preds = %for.body, %entry store i32 %conv, i32* %arrayidx, align 4 %arrayidx1 = getelementptr inbounds i32* %A, i64 %i.02 %0 = load i32* %arrayidx1, align 4 -; CHECK: da analyze - consistent flow [19]! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add i64 %i.02, 1 - %cmp = icmp ult i64 %inc, 20 - br i1 %cmp, label %for.body, label %for.end + %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] = ... -;; ... = A[2*i]; +;; 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 -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - consistent flow [3]! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -206,27 +271,33 @@ for.body: ; preds = %for.body, %entry %mul1 = shl i64 %i.02, 1 %arrayidx2 = getelementptr inbounds i32* %A, i64 %mul1 %0 = load i32* %arrayidx2, align 4 -; CHECK: da analyze - consistent flow [3]! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add i64 %i.02, 1 - %cmp = icmp ult i64 %inc, 20 - br i1 %cmp, label %for.body, label %for.end + %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] = ... -;; ... = A[2*i]; +;; 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 -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -237,27 +308,33 @@ for.body: ; preds = %for.body, %entry %mul1 = shl i64 %i.02, 1 %arrayidx2 = getelementptr inbounds i32* %A, i64 %mul1 %0 = load i32* %arrayidx2, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add i64 %i.02, 1 - %cmp = icmp ult i64 %inc, 20 - br i1 %cmp, label %for.body, label %for.end + %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] = ... -;; ... = A[i]; +;; 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 -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - consistent flow [%n|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -266,30 +343,39 @@ for.body: ; preds = %for.body, %entry store i32 %conv, i32* %arrayidx, align 4 %arrayidx1 = getelementptr inbounds i32* %A, i64 %i.02 %0 = load i32* %arrayidx1, align 4 -; CHECK: da analyze - consistent flow [%n|<]! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add i64 %i.02, 1 - %cmp = icmp ult i64 %inc, 20 - br i1 %cmp, label %for.body, label %for.end + %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] = ... -;; ... = A[i + 2*n]; +;; 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 + br i1 %cmp1, label %for.end, label %for.body.preheader -for.body: ; preds = %for.body, %entry - %i.03 = phi i64 [ %inc, %for.body ], [ 0, %entry ] - %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ] +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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* %A, i64 %add @@ -298,27 +384,36 @@ for.body: ; preds = %for.body, %entry %add1 = add i64 %i.03, %mul %arrayidx2 = getelementptr inbounds i32* %A, i64 %add1 %0 = load i32* %arrayidx2, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1 store i32 %0, i32* %B.addr.02, align 4 %inc = add i64 %i.03, 1 - %cmp = icmp ult i64 %inc, %n - br i1 %cmp, label %for.body, label %for.end + %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.body, %entry +for.end: ; preds = %for.end.loopexit, %entry ret void } -;; for (long unsigned i = 0; i < 1000; i++) -;; A[n*i + 5] = ... -;; ... = A[n*i + 5]; +;; 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 -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - consistent flow [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -330,12 +425,11 @@ for.body: ; preds = %for.body, %entry %add2 = add i64 %mul1, 5 %arrayidx3 = getelementptr inbounds i32* %A, i64 %add2 %0 = load i32* %arrayidx3, align 4 -; CHECK: da analyze - consistent flow [0|<]! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add i64 %i.02, 1 - %cmp = icmp ult i64 %inc, 1000 - br i1 %cmp, label %for.body, label %for.end + %exitcond = icmp ne i64 %inc, 1000 + br i1 %exitcond, label %for.body, label %for.end for.end: ; preds = %for.body ret void diff --git a/llvm/test/Analysis/DependenceAnalysis/SymbolicRDIV.ll b/llvm/test/Analysis/DependenceAnalysis/SymbolicRDIV.ll index 2a1b4e7..35c17b9 100644 --- a/llvm/test/Analysis/DependenceAnalysis/SymbolicRDIV.ll +++ b/llvm/test/Analysis/DependenceAnalysis/SymbolicRDIV.ll @@ -6,65 +6,99 @@ target triple = "x86_64-apple-macosx10.6.0" ;; for (long int i = 0; i < n1; i++) -;; A[2*i + n1] = ... +;; A[2*i + n1] = i; ;; for (long int j = 0; j < n2; j++) -;; ... = A[3*j + 3*n1]; +;; *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 + br i1 %cmp4, label %for.cond1.preheader, label %for.body.preheader -for.cond1.preheader: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 + br i1 %cmp21, label %for.end11, label %for.body4.preheader -for.body: ; preds = %for.body, %entry - %i.05 = phi i64 [ %inc, %for.body ], [ 0, %entry ] +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* %A, i64 %add store i32 %conv, i32* %arrayidx, align 4 %inc = add nsw i64 %i.05, 1 - %cmp = icmp ult i64 %inc, %n1 - br i1 %cmp, label %for.body, label %for.cond1.preheader + %exitcond = icmp ne i64 %inc, %n1 + br i1 %exitcond, label %for.body, label %for.cond1.preheader.loopexit -for.body4: ; preds = %for.body4, %for.cond1.preheader - %j.03 = phi i64 [ %inc10, %for.body4 ], [ 0, %for.cond1.preheader ] - %B.addr.02 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.cond1.preheader ] +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* %A, i64 %add7 %0 = load i32* %arrayidx8, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1 store i32 %0, i32* %B.addr.02, align 4 %inc10 = add nsw i64 %j.03, 1 - %cmp2 = icmp ult i64 %inc10, %n2 - br i1 %cmp2, label %for.body4, label %for.end11 + %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.body4, %for.cond1.preheader +for.end11: ; preds = %for.end11.loopexit, %for.cond1.preheader ret void } ;; for (long int i = 0; i < n1; i++) -;; A[2*i + 5*n2] = ... +;; A[2*i + 5*n2] = i; ;; for (long int j = 0; j < n2; j++) -;; ... = A[3*j + 2*n2]; +;; *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 + br i1 %cmp4, label %for.cond2.preheader, label %for.body.preheader -for.cond2.preheader: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 + 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, %entry - %i.05 = phi i64 [ %inc, %for.body ], [ 0, %entry ] +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 @@ -72,220 +106,307 @@ for.body: ; preds = %for.body, %entry %arrayidx = getelementptr inbounds i32* %A, i64 %add store i32 %conv, i32* %arrayidx, align 4 %inc = add nsw i64 %i.05, 1 - %cmp = icmp ult i64 %inc, %n1 - br i1 %cmp, label %for.body, label %for.cond2.preheader + %exitcond = icmp ne i64 %inc, %n1 + br i1 %exitcond, label %for.body, label %for.cond2.preheader.loopexit -for.body5: ; preds = %for.body5, %for.cond2.preheader - %j.03 = phi i64 [ %inc11, %for.body5 ], [ 0, %for.cond2.preheader ] - %B.addr.02 = phi i32* [ %incdec.ptr, %for.body5 ], [ %B, %for.cond2.preheader ] +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* %A, i64 %add8 %0 = load i32* %arrayidx9, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1 store i32 %0, i32* %B.addr.02, align 4 %inc11 = add nsw i64 %j.03, 1 - %cmp3 = icmp ult i64 %inc11, %n2 - br i1 %cmp3, label %for.body5, label %for.end12 + %exitcond6 = icmp ne i64 %inc11, %n2 + br i1 %exitcond6, label %for.body5, label %for.end12.loopexit -for.end12: ; preds = %for.body5, %for.cond2.preheader +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] = ... +;; A[2*i - n2] = i; ;; for (long int j = 0; j < n2; j++) -;; ... = A[-j + 2*n1]; +;; *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 + br i1 %cmp4, label %for.cond1.preheader, label %for.body.preheader + +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! -for.cond1.preheader: ; preds = %for.body, %entry +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 + 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, %entry - %i.05 = phi i64 [ %inc, %for.body ], [ 0, %entry ] +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* %A, i64 %sub store i32 %conv, i32* %arrayidx, align 4 %inc = add nsw i64 %i.05, 1 - %cmp = icmp ult i64 %inc, %n1 - br i1 %cmp, label %for.body, label %for.cond1.preheader + %exitcond = icmp ne i64 %inc, %n1 + br i1 %exitcond, label %for.body, label %for.cond1.preheader.loopexit -for.body4: ; preds = %for.body4, %for.cond1.preheader - %j.03 = phi i64 [ %inc9, %for.body4 ], [ 0, %for.cond1.preheader ] - %B.addr.02 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.cond1.preheader ] +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* %A, i64 %add %0 = load i32* %arrayidx7, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1 store i32 %0, i32* %B.addr.02, align 4 %inc9 = add nsw i64 %j.03, 1 - %cmp2 = icmp ult i64 %inc9, %n2 - br i1 %cmp2, label %for.body4, label %for.end10 + %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.body4, %for.cond1.preheader +for.end10: ; preds = %for.end10.loopexit, %for.cond1.preheader ret void } ;; for (long int i = 0; i < n1; i++) -;; A[-i + n2] = ... +;; A[-i + n2] = i; ;; for (long int j = 0; j < n2; j++) -;; ... = A[j - n1]; +;; *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 + br i1 %cmp4, label %for.cond1.preheader, label %for.body.preheader + +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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.body, %entry +for.cond1.preheader: ; preds = %for.cond1.preheader.loopexit, %entry %cmp21 = icmp eq i64 %n2, 0 - br i1 %cmp21, label %for.end9, label %for.body4 + br i1 %cmp21, label %for.end9, label %for.body4.preheader -for.body: ; preds = %for.body, %entry - %i.05 = phi i64 [ %inc, %for.body ], [ 0, %entry ] +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* %A, i64 %add store i32 %conv, i32* %arrayidx, align 4 %inc = add nsw i64 %i.05, 1 - %cmp = icmp ult i64 %inc, %n1 - br i1 %cmp, label %for.body, label %for.cond1.preheader + %exitcond = icmp ne i64 %inc, %n1 + br i1 %exitcond, label %for.body, label %for.cond1.preheader.loopexit -for.body4: ; preds = %for.body4, %for.cond1.preheader - %j.03 = phi i64 [ %inc8, %for.body4 ], [ 0, %for.cond1.preheader ] - %B.addr.02 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.cond1.preheader ] +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* %A, i64 %sub5 %0 = load i32* %arrayidx6, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1 store i32 %0, i32* %B.addr.02, align 4 %inc8 = add nsw i64 %j.03, 1 - %cmp2 = icmp ult i64 %inc8, %n2 - br i1 %cmp2, label %for.body4, label %for.end9 + %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.body4, %for.cond1.preheader +for.end9: ; preds = %for.end9.loopexit, %for.cond1.preheader ret void } ;; for (long int i = 0; i < n1; i++) -;; A[-i + 2*n1] = ... +;; A[-i + 2*n1] = i; ;; for (long int j = 0; j < n2; j++) -;; ... = A[-j + n1]; +;; *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 + br i1 %cmp4, label %for.cond1.preheader, label %for.body.preheader + +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +for.body.preheader: ; preds = %entry + br label %for.body -for.cond1.preheader: ; preds = %for.body, %entry +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 + 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, %entry - %i.05 = phi i64 [ %inc, %for.body ], [ 0, %entry ] +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* %A, i64 %add store i32 %conv, i32* %arrayidx, align 4 %inc = add nsw i64 %i.05, 1 - %cmp = icmp ult i64 %inc, %n1 - br i1 %cmp, label %for.body, label %for.cond1.preheader + %exitcond = icmp ne i64 %inc, %n1 + br i1 %exitcond, label %for.body, label %for.cond1.preheader.loopexit -for.body4: ; preds = %for.body4, %for.cond1.preheader - %j.03 = phi i64 [ %inc9, %for.body4 ], [ 0, %for.cond1.preheader ] - %B.addr.02 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.cond1.preheader ] +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* %A, i64 %add6 %0 = load i32* %arrayidx7, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1 store i32 %0, i32* %B.addr.02, align 4 %inc9 = add nsw i64 %j.03, 1 - %cmp2 = icmp ult i64 %inc9, %n2 - br i1 %cmp2, label %for.body4, label %for.end10 + %exitcond6 = icmp ne i64 %inc9, %n2 + br i1 %exitcond6, label %for.body4, label %for.end10.loopexit -for.end10: ; preds = %for.body4, %for.cond1.preheader +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] = ... +;; A[-i + n2] = i; ;; for (long int j = 0; j < n2; j++) -;; ... = A[-j + 2*n2]; +;; *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 + br i1 %cmp4, label %for.cond1.preheader, label %for.body.preheader + +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! -for.cond1.preheader: ; preds = %for.body, %entry +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 + 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, %entry - %i.05 = phi i64 [ %inc, %for.body ], [ 0, %entry ] +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* %A, i64 %add store i32 %conv, i32* %arrayidx, align 4 %inc = add nsw i64 %i.05, 1 - %cmp = icmp ult i64 %inc, %n1 - br i1 %cmp, label %for.body, label %for.cond1.preheader + %exitcond = icmp ne i64 %inc, %n1 + br i1 %exitcond, label %for.body, label %for.cond1.preheader.loopexit -for.body4: ; preds = %for.body4, %for.cond1.preheader - %j.03 = phi i64 [ %inc9, %for.body4 ], [ 0, %for.cond1.preheader ] - %B.addr.02 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.cond1.preheader ] +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* %A, i64 %add6 %0 = load i32* %arrayidx7, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1 store i32 %0, i32* %B.addr.02, align 4 %inc9 = add nsw i64 %j.03, 1 - %cmp2 = icmp ult i64 %inc9, %n2 - br i1 %cmp2, label %for.body4, label %for.end10 + %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.body4, %for.cond1.preheader +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] = ... -;; ... = A[2*n2]; +;; 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 + br i1 %cmp4, label %for.end7, label %for.cond1.preheader.preheader + +; 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 - confused! + +for.cond1.preheader.preheader: ; preds = %entry + br label %for.cond1.preheader -for.cond1.preheader: ; preds = %for.inc5, %entry - %B.addr.06 = phi i32* [ %B.addr.1.lcssa, %for.inc5 ], [ %B, %entry ] - %i.05 = phi i64 [ %inc6, %for.inc5 ], [ 0, %entry ] +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 + 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, %for.cond1.preheader - %j.03 = phi i64 [ %inc, %for.body3 ], [ 0, %for.cond1.preheader ] - %B.addr.12 = phi i32* [ %incdec.ptr, %for.body3 ], [ %B.addr.06, %for.cond1.preheader ] +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 @@ -294,19 +415,25 @@ for.body3: ; preds = %for.body3, %for.con %mul = shl i64 %n2, 1 %arrayidx4 = getelementptr inbounds i32* %A, i64 %mul %0 = load i32* %arrayidx4, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.12, i64 1 store i32 %0, i32* %B.addr.12, align 4 %inc = add nsw i64 %j.03, 1 - %cmp2 = icmp ult i64 %inc, %n2 - br i1 %cmp2, label %for.body3, label %for.inc5 + %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* %B.addr.06, i64 %n2 + br label %for.inc5 -for.inc5: ; preds = %for.body3, %for.cond1.preheader - %B.addr.1.lcssa = phi i32* [ %B.addr.06, %for.cond1.preheader ], [ %incdec.ptr, %for.body3 ] +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 - %cmp = icmp ult i64 %inc6, %n1 - br i1 %cmp, label %for.cond1.preheader, label %for.end7 + %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.inc5, %entry +for.end7: ; preds = %for.end7.loopexit, %entry ret void } diff --git a/llvm/test/Analysis/DependenceAnalysis/SymbolicSIV.ll b/llvm/test/Analysis/DependenceAnalysis/SymbolicSIV.ll index ee2343f..619abd5 100644 --- a/llvm/test/Analysis/DependenceAnalysis/SymbolicSIV.ll +++ b/llvm/test/Analysis/DependenceAnalysis/SymbolicSIV.ll @@ -5,18 +5,28 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3 target triple = "x86_64-apple-macosx10.6.0" -;; for (long int i = 0; i < n; i++) -;; A[2*i + n] = ... -;; ... = A[3*i + 3*n]; +;; 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 + br i1 %cmp1, label %for.end, label %for.body.preheader + +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +for.body.preheader: ; preds = %entry + br label %for.body -for.body: ; preds = %for.body, %entry - %i.03 = phi i64 [ %inc, %for.body ], [ 0, %entry ] - %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ] +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 @@ -26,30 +36,42 @@ for.body: ; preds = %for.body, %entry %add3 = mul i64 %mul14, 3 %arrayidx4 = getelementptr inbounds i32* %A, i64 %add3 %0 = load i32* %arrayidx4, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1 store i32 %0, i32* %B.addr.02, align 4 %inc = add nsw i64 %i.03, 1 - %cmp = icmp ult i64 %inc, %n - br i1 %cmp, label %for.body, label %for.end + %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.body, %entry +for.end: ; preds = %for.end.loopexit, %entry ret void } -;; for (long int i = 0; i < n; i++) -;; A[2*i + 5*n] = ... -;; ... = A[3*i + 2*n]; +;; 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 + br i1 %cmp1, label %for.end, label %for.body.preheader + +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! -for.body: ; preds = %for.body, %entry - %i.03 = phi i64 [ %inc, %for.body ], [ 0, %entry ] - %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ] +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 @@ -61,30 +83,42 @@ for.body: ; preds = %for.body, %entry %add4 = add i64 %mul2, %mul3 %arrayidx5 = getelementptr inbounds i32* %A, i64 %add4 %0 = load i32* %arrayidx5, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1 store i32 %0, i32* %B.addr.02, align 4 %inc = add nsw i64 %i.03, 1 - %cmp = icmp ult i64 %inc, %n - br i1 %cmp, label %for.body, label %for.end + %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.body, %entry +for.end: ; preds = %for.end.loopexit, %entry ret void } -;; for (long int i = 0; i < n; i++) -;; A[2*i - n] = ... -;; ... = A[-i + 2*n]; +;; 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 + br i1 %cmp1, label %for.end, label %for.body.preheader + +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +for.body.preheader: ; preds = %entry + br label %for.body -for.body: ; preds = %for.body, %entry - %i.03 = phi i64 [ %inc, %for.body ], [ 0, %entry ] - %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ] +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 @@ -94,30 +128,42 @@ for.body: ; preds = %for.body, %entry %add = sub i64 %mul2, %i.03 %arrayidx3 = getelementptr inbounds i32* %A, i64 %add %0 = load i32* %arrayidx3, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1 store i32 %0, i32* %B.addr.02, align 4 %inc = add nsw i64 %i.03, 1 - %cmp = icmp ult i64 %inc, %n - br i1 %cmp, label %for.body, label %for.end + %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.body, %entry +for.end: ; preds = %for.end.loopexit, %entry ret void } -;; for (long int i = 0; i < n; i++) -;; A[-2*i + n + 1] = ... -;; ... = A[i - 2*n]; +;; 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 + br i1 %cmp1, label %for.end, label %for.body.preheader -for.body: ; preds = %for.body, %entry - %i.03 = phi i64 [ %inc, %for.body ], [ 0, %entry ] - %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ] +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -128,30 +174,42 @@ for.body: ; preds = %for.body, %entry %sub = sub i64 %i.03, %mul2 %arrayidx3 = getelementptr inbounds i32* %A, i64 %sub %0 = load i32* %arrayidx3, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1 store i32 %0, i32* %B.addr.02, align 4 %inc = add nsw i64 %i.03, 1 - %cmp = icmp ult i64 %inc, %n - br i1 %cmp, label %for.body, label %for.end + %exitcond = icmp ne i64 %inc, %n + br i1 %exitcond, label %for.body, label %for.end.loopexit -for.end: ; preds = %for.body, %entry +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] = ... -;; ... = A[-i + n]; +;; 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 + br i1 %cmp1, label %for.end, label %for.body.preheader + +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! -for.body: ; preds = %for.body, %entry - %i.03 = phi i64 [ %inc, %for.body ], [ 0, %entry ] - %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ] +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 @@ -161,30 +219,42 @@ for.body: ; preds = %for.body, %entry %add2 = sub i64 %n, %i.03 %arrayidx3 = getelementptr inbounds i32* %A, i64 %add2 %0 = load i32* %arrayidx3, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1 store i32 %0, i32* %B.addr.02, align 4 %inc = add nsw i64 %i.03, 1 - %cmp = icmp ult i64 %inc, %n - br i1 %cmp, label %for.body, label %for.end + %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.body, %entry +for.end: ; preds = %for.end.loopexit, %entry ret void } -;; for (long int i = 0; i < n; i++) -;; A[-2*i - 2*n] = ... -;; ... = A[-i - n]; +;; 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 + br i1 %cmp1, label %for.end, label %for.body.preheader + +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! -for.body: ; preds = %for.body, %entry - %i.03 = phi i64 [ %inc, %for.body ], [ 0, %entry ] - %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ] +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 @@ -195,32 +265,44 @@ for.body: ; preds = %for.body, %entry %sub3 = sub i64 %sub2, %n %arrayidx4 = getelementptr inbounds i32* %A, i64 %sub3 %0 = load i32* %arrayidx4, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1 store i32 %0, i32* %B.addr.02, align 4 %inc = add nsw i64 %i.03, 1 - %cmp = icmp ult i64 %inc, %n - br i1 %cmp, label %for.body, label %for.end + %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.body, %entry +for.end: ; preds = %for.end.loopexit, %entry ret void } ;; why doesn't SCEV package understand that n >= 0? -;;void weaktest(int *A, int *B, long unsigned n) -;; for (long unsigned i = 0; i < n; i++) -;; A[i + n + 1] = ... -;; ... = A[-i]; +;; 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 + br i1 %cmp1, label %for.end, label %for.body.preheader -for.body: ; preds = %for.body, %entry - %i.03 = phi i64 [ %inc, %for.body ], [ 0, %entry ] - %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ] +; CHECK: da analyze - consistent output [0|<]! +; 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 - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -229,29 +311,36 @@ for.body: ; preds = %for.body, %entry %sub = sub i64 0, %i.03 %arrayidx2 = getelementptr inbounds i32* %A, i64 %sub %0 = load i32* %arrayidx2, align 4 -; CHECK: da analyze - flow [*|<] splitable! -; CHECK: da analyze - split level = 1, iteration = ((0 smax (-1 + (-1 * %n))) /u 2)! %incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1 store i32 %0, i32* %B.addr.02, align 4 %inc = add i64 %i.03, 1 - %cmp = icmp ult i64 %inc, %n - br i1 %cmp, label %for.body, label %for.end + %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.body, %entry +for.end: ; preds = %for.end.loopexit, %entry ret void } -;; void symbolicsiv6(int *A, int *B, long unsigned n, long unsigned N, long unsigned M) { -;; for (long int i = 0; i < n; i++) { -;; A[4*N*i + M] = i; -;; *B++ = A[4*N*i + 3*M + 1]; +;; 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 - consistent output [0|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + for.body.preheader: ; preds = %entry br label %for.body @@ -272,7 +361,6 @@ for.body: ; preds = %for.body.preheader, %arrayidx7 = getelementptr inbounds i32* %A, i64 %add6 %0 = load i32* %arrayidx7, align 4 %incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1 -; CHECK: da analyze - none! store i32 %0, i32* %B.addr.02, align 4 %inc = add nsw i64 %i.03, 1 %exitcond = icmp ne i64 %inc, %n @@ -286,16 +374,22 @@ for.end: ; preds = %for.end.loopexit, % } -;; void symbolicsiv7(int *A, int *B, long unsigned n, long unsigned N, long unsigned M) { -;; for (long int i = 0; i < n; i++) { -;; A[2*N*i + M] = i; -;; *B++ = A[2*N*i - 3*M + 2]; +;; 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 - consistent output [0|<]! +; CHECK: da analyze - flow [<>]! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + for.body.preheader: ; preds = %entry br label %for.body @@ -316,7 +410,6 @@ for.body: ; preds = %for.body.preheader, %arrayidx6 = getelementptr inbounds i32* %A, i64 %add5 %1 = load i32* %arrayidx6, align 4 %incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1 -; CHECK: da analyze - flow [<>]! store i32 %1, i32* %B.addr.02, align 4 %inc = add nsw i64 %i.03, 1 %exitcond = icmp ne i64 %inc, %n diff --git a/llvm/test/Analysis/DependenceAnalysis/WeakCrossingSIV.ll b/llvm/test/Analysis/DependenceAnalysis/WeakCrossingSIV.ll index 343e8f4..1bc6c16 100644 --- a/llvm/test/Analysis/DependenceAnalysis/WeakCrossingSIV.ll +++ b/llvm/test/Analysis/DependenceAnalysis/WeakCrossingSIV.ll @@ -5,18 +5,28 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3 target triple = "x86_64-apple-macosx10.6.0" -;; for (long unsigned i = 0; i < n; i++) -;; A[1 + n*i] = ... -;; ... = A[1 - n*i]; +;; 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 + br i1 %cmp1, label %for.end, label %for.body.preheader -for.body: ; preds = %for.body, %entry - %i.03 = phi i64 [ %inc, %for.body ], [ 0, %entry ] - %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ] +for.body.preheader: ; preds = %entry + br label %for.body + +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - flow [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -26,30 +36,43 @@ for.body: ; preds = %for.body, %entry %sub = sub i64 1, %mul1 %arrayidx2 = getelementptr inbounds i32* %A, i64 %sub %0 = load i32* %arrayidx2, align 4 -; CHECK: da analyze - flow [0|<]! %incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1 store i32 %0, i32* %B.addr.02, align 4 %inc = add i64 %i.03, 1 - %cmp = icmp ult i64 %inc, %n - br i1 %cmp, label %for.body, label %for.end + %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.body, %entry +for.end: ; preds = %for.end.loopexit, %entry ret void } -;; for (long unsigned i = 0; i < n; i++) -;; A[n + i] = ... -;; ... = A[1 + n - i]; +;; 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 + br i1 %cmp1, label %for.end, label %for.body.preheader -for.body: ; preds = %for.body, %entry - %i.03 = phi i64 [ %inc, %for.body ], [ 0, %entry ] - %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ] +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - flow [<>] splitable! +; CHECK: da analyze - split level = 1, iteration = 0! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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* %A, i64 %add @@ -58,28 +81,36 @@ for.body: ; preds = %for.body, %entry %sub = sub i64 %add1, %i.03 %arrayidx2 = getelementptr inbounds i32* %A, i64 %sub %0 = load i32* %arrayidx2, align 4 -; CHECK: da analyze - flow [<>] splitable! -; CHECK: da analyze - split level = 1, iteration = 0! %incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1 store i32 %0, i32* %B.addr.02, align 4 %inc = add i64 %i.03, 1 - %cmp = icmp ult i64 %inc, %n - br i1 %cmp, label %for.body, label %for.end + %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.body, %entry +for.end: ; preds = %for.end.loopexit, %entry ret void } -;; for (long unsigned i = 0; i < 3; i++) -;; A[i] = ... -;; ... = A[6 - i]; +;; 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 -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -88,27 +119,33 @@ for.body: ; preds = %for.body, %entry %sub = sub i64 6, %i.02 %arrayidx1 = getelementptr inbounds i32* %A, i64 %sub %0 = load i32* %arrayidx1, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add i64 %i.02, 1 - %cmp = icmp ult i64 %inc, 3 - br i1 %cmp, label %for.body, label %for.end + %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] = ... -;; ... = A[6 - i]; +;; 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 -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - flow [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -117,27 +154,33 @@ for.body: ; preds = %for.body, %entry %sub = sub i64 6, %i.02 %arrayidx1 = getelementptr inbounds i32* %A, i64 %sub %0 = load i32* %arrayidx1, align 4 -; CHECK: da analyze - flow [0|<]! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add i64 %i.02, 1 - %cmp = icmp ult i64 %inc, 4 - br i1 %cmp, label %for.body, label %for.end + %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] = ... -;; ... = A[-6 - i]; +;; 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 -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -146,30 +189,39 @@ for.body: ; preds = %for.body, %entry %sub = sub i64 -6, %i.02 %arrayidx1 = getelementptr inbounds i32* %A, i64 %sub %0 = load i32* %arrayidx1, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add i64 %i.02, 1 - %cmp = icmp ult i64 %inc, 10 - br i1 %cmp, label %for.body, label %for.end + %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] = ... -;; ... = A[5 - 3*i]; +;; 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 + br i1 %cmp1, label %for.end, label %for.body.preheader + +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +for.body.preheader: ; preds = %entry + br label %for.body -for.body: ; preds = %for.body, %entry - %i.03 = phi i64 [ %inc, %for.body ], [ 0, %entry ] - %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ] +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* %A, i64 %mul @@ -178,27 +230,37 @@ for.body: ; preds = %for.body, %entry %sub = add i64 %0, 5 %arrayidx2 = getelementptr inbounds i32* %A, i64 %sub %1 = load i32* %arrayidx2, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1 store i32 %1, i32* %B.addr.02, align 4 %inc = add i64 %i.03, 1 - %cmp = icmp ult i64 %inc, %n - br i1 %cmp, label %for.body, label %for.end + %exitcond = icmp ne i64 %inc, %n + br i1 %exitcond, label %for.body, label %for.end.loopexit -for.end: ; preds = %for.body, %entry +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] = ... -;; ... = A[5 - i]; +;; 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 -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - flow [<>] splitable! +; CHECK: da analyze - split level = 1, iteration = 2! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -207,13 +269,11 @@ for.body: ; preds = %for.body, %entry %sub = sub i64 5, %i.02 %arrayidx1 = getelementptr inbounds i32* %A, i64 %sub %0 = load i32* %arrayidx1, align 4 -; CHECK: da analyze - flow [<>] splitable! -; CHECK: da analyze - split level = 1, iteration = 2! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add i64 %i.02, 1 - %cmp = icmp ult i64 %inc, 4 - br i1 %cmp, label %for.body, label %for.end + %exitcond = icmp ne i64 %inc, 4 + br i1 %exitcond, label %for.body, label %for.end for.end: ; preds = %for.body ret void diff --git a/llvm/test/Analysis/DependenceAnalysis/WeakZeroDstSIV.ll b/llvm/test/Analysis/DependenceAnalysis/WeakZeroDstSIV.ll index a598716..064d88e 100644 --- a/llvm/test/Analysis/DependenceAnalysis/WeakZeroDstSIV.ll +++ b/llvm/test/Analysis/DependenceAnalysis/WeakZeroDstSIV.ll @@ -5,15 +5,22 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3 target triple = "x86_64-apple-macosx10.6.0" -;; for (long unsigned i = 0; i < 30; i++) -;; A[2*i + 10] = ... -;; ... = A[10]; +;; for (long unsigned i = 0; i < 30; i++) { +;; A[2*i + 10] = i; +;; *B++ = A[10]; define void @weakzerodst0(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - flow [p<=|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [S|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -23,30 +30,39 @@ for.body: ; preds = %for.body, %entry store i32 %conv, i32* %arrayidx, align 4 %arrayidx1 = getelementptr inbounds i32* %A, i64 10 %0 = load i32* %arrayidx1, align 4 -; CHECK: da analyze - flow [p<=|<]! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add i64 %i.02, 1 - %cmp = icmp ult i64 %inc, 30 - br i1 %cmp, label %for.body, label %for.end + %exitcond = icmp ne i64 %inc, 30 + 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[n*i + 10] = ... -;; ... = A[10]; +;; for (long unsigned i = 0; i < n; i++) { +;; A[n*i + 10] = i; +;; *B++ = A[10]; define void @weakzerodst1(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 + br i1 %cmp1, label %for.end, label %for.body.preheader + +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - flow [p<=|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [S|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +for.body.preheader: ; preds = %entry + br label %for.body -for.body: ; preds = %for.body, %entry - %i.03 = phi i64 [ %inc, %for.body ], [ 0, %entry ] - %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ] +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, 10 @@ -54,27 +70,36 @@ for.body: ; preds = %for.body, %entry store i32 %conv, i32* %arrayidx, align 4 %arrayidx1 = getelementptr inbounds i32* %A, i64 10 %0 = load i32* %arrayidx1, align 4 -; CHECK: da analyze - flow [p<=|<]! %incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1 store i32 %0, i32* %B.addr.02, align 4 %inc = add i64 %i.03, 1 - %cmp = icmp ult i64 %inc, %n - br i1 %cmp, label %for.body, label %for.end + %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.body, %entry +for.end: ; preds = %for.end.loopexit, %entry ret void } -;; for (long unsigned i = 0; i < 5; i++) -;; A[2*i] = ... -;; ... = A[10]; +;; for (long unsigned i = 0; i < 5; i++) { +;; A[2*i] = i; +;; *B++ = A[10]; define void @weakzerodst2(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [S|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -83,27 +108,33 @@ for.body: ; preds = %for.body, %entry store i32 %conv, i32* %arrayidx, align 4 %arrayidx1 = getelementptr inbounds i32* %A, i64 10 %0 = load i32* %arrayidx1, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add i64 %i.02, 1 - %cmp = icmp ult i64 %inc, 5 - br i1 %cmp, label %for.body, label %for.end + %exitcond = icmp ne i64 %inc, 5 + br i1 %exitcond, label %for.body, label %for.end for.end: ; preds = %for.body ret void } -;; for (long unsigned i = 0; i < 6; i++) -;; A[2*i] = ... -;; ... = A[10]; +;; for (long unsigned i = 0; i < 6; i++) { +;; A[2*i] = i; +;; *B++ = A[10]; define void @weakzerodst3(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - flow [=>p|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [S|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -112,27 +143,33 @@ for.body: ; preds = %for.body, %entry store i32 %conv, i32* %arrayidx, align 4 %arrayidx1 = getelementptr inbounds i32* %A, i64 10 %0 = load i32* %arrayidx1, align 4 -; CHECK: da analyze - flow [=>p|<]! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add i64 %i.02, 1 - %cmp = icmp ult i64 %inc, 6 - br i1 %cmp, label %for.body, label %for.end + %exitcond = icmp ne i64 %inc, 6 + br i1 %exitcond, label %for.body, label %for.end for.end: ; preds = %for.body ret void } -;; for (long unsigned i = 0; i < 7; i++) -;; A[2*i] = ... -;; ... = A[10]; +;; for (long unsigned i = 0; i < 7; i++) { +;; A[2*i] = i; +;; *B++ = A[10]; define void @weakzerodst4(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - flow [*|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [S|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -141,27 +178,33 @@ for.body: ; preds = %for.body, %entry store i32 %conv, i32* %arrayidx, align 4 %arrayidx1 = getelementptr inbounds i32* %A, i64 10 %0 = load i32* %arrayidx1, align 4 -; CHECK: da analyze - flow [*|<]! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add i64 %i.02, 1 - %cmp = icmp ult i64 %inc, 7 - br i1 %cmp, label %for.body, label %for.end + %exitcond = icmp ne i64 %inc, 7 + br i1 %exitcond, label %for.body, label %for.end for.end: ; preds = %for.body ret void } -;; for (long unsigned i = 0; i < 7; i++) -;; A[2*i] = ... -;; ... = A[-10]; +;; for (long unsigned i = 0; i < 7; i++) { +;; A[2*i] = i; +;; *B++ = A[-10]; define void @weakzerodst5(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [S|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -170,43 +213,54 @@ for.body: ; preds = %for.body, %entry store i32 %conv, i32* %arrayidx, align 4 %arrayidx1 = getelementptr inbounds i32* %A, i64 -10 %0 = load i32* %arrayidx1, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add i64 %i.02, 1 - %cmp = icmp ult i64 %inc, 7 - br i1 %cmp, label %for.body, label %for.end + %exitcond = icmp ne i64 %inc, 7 + 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] = ... -;; ... = A[10]; +;; for (long unsigned i = 0; i < n; i++) { +;; A[3*i] = i; +;; *B++ = A[10]; define void @weakzerodst6(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 + br i1 %cmp1, label %for.end, label %for.body.preheader -for.body: ; preds = %for.body, %entry - %i.03 = phi i64 [ %inc, %for.body ], [ 0, %entry ] - %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ] +; CHECK: da analyze - consistent output [0|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [S|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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* %A, i64 %mul store i32 %conv, i32* %arrayidx, align 4 %arrayidx1 = getelementptr inbounds i32* %A, i64 10 %0 = load i32* %arrayidx1, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1 store i32 %0, i32* %B.addr.02, align 4 %inc = add i64 %i.03, 1 - %cmp = icmp ult i64 %inc, %n - br i1 %cmp, label %for.body, label %for.end + %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.body, %entry +for.end: ; preds = %for.end.loopexit, %entry ret void } diff --git a/llvm/test/Analysis/DependenceAnalysis/WeakZeroSrcSIV.ll b/llvm/test/Analysis/DependenceAnalysis/WeakZeroSrcSIV.ll index fd4f462..4fe491c 100644 --- a/llvm/test/Analysis/DependenceAnalysis/WeakZeroSrcSIV.ll +++ b/llvm/test/Analysis/DependenceAnalysis/WeakZeroSrcSIV.ll @@ -5,15 +5,22 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3 target triple = "x86_64-apple-macosx10.6.0" -;; for (long unsigned i = 0; i < 30; i++) -;; A[10] = ... -;; ... = A[2*i + 10]; +;; for (long unsigned i = 0; i < 30; i++) { +;; A[10] = i; +;; *B++ = A[2*i + 10]; define void @weakzerosrc0(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [S|<]! +; CHECK: da analyze - flow [p<=|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -23,30 +30,39 @@ for.body: ; preds = %for.body, %entry %add = add i64 %mul, 10 %arrayidx1 = getelementptr inbounds i32* %A, i64 %add %0 = load i32* %arrayidx1, align 4 -; CHECK: da analyze - flow [p<=|<]! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add i64 %i.02, 1 - %cmp = icmp ult i64 %inc, 30 - br i1 %cmp, label %for.body, label %for.end + %exitcond = icmp ne i64 %inc, 30 + 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[10] = ... -;; ... = A[n*i + 10]; +;; for (long unsigned i = 0; i < n; i++) { +;; A[10] = i; +;; *B++ = A[n*i + 10]; define void @weakzerosrc1(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 + br i1 %cmp1, label %for.end, label %for.body.preheader + +; CHECK: da analyze - consistent output [S|<]! +; CHECK: da analyze - flow [p<=|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +for.body.preheader: ; preds = %entry + br label %for.body -for.body: ; preds = %for.body, %entry - %i.03 = phi i64 [ %inc, %for.body ], [ 0, %entry ] - %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ] +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 %arrayidx = getelementptr inbounds i32* %A, i64 10 store i32 %conv, i32* %arrayidx, align 4 @@ -54,27 +70,36 @@ for.body: ; preds = %for.body, %entry %add = add i64 %mul, 10 %arrayidx1 = getelementptr inbounds i32* %A, i64 %add %0 = load i32* %arrayidx1, align 4 -; CHECK: da analyze - flow [p<=|<]! %incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1 store i32 %0, i32* %B.addr.02, align 4 %inc = add i64 %i.03, 1 - %cmp = icmp ult i64 %inc, %n - br i1 %cmp, label %for.body, label %for.end + %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.body, %entry +for.end: ; preds = %for.end.loopexit, %entry ret void } -;; for (long unsigned i = 0; i < 5; i++) -;; A[10] = ... -;; ... = A[2*i]; +;; for (long unsigned i = 0; i < 5; i++) { +;; A[10] = i; +;; *B++ = A[2*i]; define void @weakzerosrc2(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [S|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -83,27 +108,33 @@ for.body: ; preds = %for.body, %entry %mul = shl i64 %i.02, 1 %arrayidx1 = getelementptr inbounds i32* %A, i64 %mul %0 = load i32* %arrayidx1, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add i64 %i.02, 1 - %cmp = icmp ult i64 %inc, 5 - br i1 %cmp, label %for.body, label %for.end + %exitcond = icmp ne i64 %inc, 5 + br i1 %exitcond, label %for.body, label %for.end for.end: ; preds = %for.body ret void } -;; for (long unsigned i = 0; i < 6; i++) -;; A[10] = ... -;; ... = A[2*i]; +;; for (long unsigned i = 0; i < 6; i++) { +;; A[10] = i; +;; *B++ = A[2*i]; define void @weakzerosrc3(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [S|<]! +; CHECK: da analyze - flow [=>p|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -112,27 +143,33 @@ for.body: ; preds = %for.body, %entry %mul = shl i64 %i.02, 1 %arrayidx1 = getelementptr inbounds i32* %A, i64 %mul %0 = load i32* %arrayidx1, align 4 -; CHECK: da analyze - flow [=>p|<]! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add i64 %i.02, 1 - %cmp = icmp ult i64 %inc, 6 - br i1 %cmp, label %for.body, label %for.end + %exitcond = icmp ne i64 %inc, 6 + br i1 %exitcond, label %for.body, label %for.end for.end: ; preds = %for.body ret void } -;; for (long unsigned i = 0; i < 7; i++) -;; A[10] = ... -;; ... = A[2*i]; +;; for (long unsigned i = 0; i < 7; i++) { +;; A[10] = i; +;; *B++ = A[2*i]; define void @weakzerosrc4(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [S|<]! +; CHECK: da analyze - flow [*|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -141,27 +178,33 @@ for.body: ; preds = %for.body, %entry %mul = shl i64 %i.02, 1 %arrayidx1 = getelementptr inbounds i32* %A, i64 %mul %0 = load i32* %arrayidx1, align 4 -; CHECK: da analyze - flow [*|<]! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add i64 %i.02, 1 - %cmp = icmp ult i64 %inc, 7 - br i1 %cmp, label %for.body, label %for.end + %exitcond = icmp ne i64 %inc, 7 + br i1 %exitcond, label %for.body, label %for.end for.end: ; preds = %for.body ret void } -;; for (long unsigned i = 0; i < 7; i++) -;; A[-10] = ... -;; ... = A[2*i]; +;; for (long unsigned i = 0; i < 7; i++) { +;; A[-10] = i; +;; *B++ = A[2*i]; define void @weakzerosrc5(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp { entry: br label %for.body -for.body: ; preds = %for.body, %entry +; CHECK: da analyze - consistent output [S|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 @@ -170,43 +213,54 @@ for.body: ; preds = %for.body, %entry %mul = shl i64 %i.02, 1 %arrayidx1 = getelementptr inbounds i32* %A, i64 %mul %0 = load i32* %arrayidx1, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1 store i32 %0, i32* %B.addr.01, align 4 %inc = add i64 %i.02, 1 - %cmp = icmp ult i64 %inc, 7 - br i1 %cmp, label %for.body, label %for.end + %exitcond = icmp ne i64 %inc, 7 + 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[10] = ... -;; ... = A[3*i]; +;; for (long unsigned i = 0; i < n; i++) { +;; A[10] = i; +;; *B++ = A[3*i]; define void @weakzerosrc6(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 + br i1 %cmp1, label %for.end, label %for.body.preheader -for.body: ; preds = %for.body, %entry - %i.03 = phi i64 [ %inc, %for.body ], [ 0, %entry ] - %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ] +; CHECK: da analyze - consistent output [S|<]! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input [0|<]! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + +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 %arrayidx = getelementptr inbounds i32* %A, i64 10 store i32 %conv, i32* %arrayidx, align 4 %mul = mul i64 %i.03, 3 %arrayidx1 = getelementptr inbounds i32* %A, i64 %mul %0 = load i32* %arrayidx1, align 4 -; CHECK: da analyze - none! %incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1 store i32 %0, i32* %B.addr.02, align 4 %inc = add i64 %i.03, 1 - %cmp = icmp ult i64 %inc, %n - br i1 %cmp, label %for.body, label %for.end + %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.body, %entry +for.end: ; preds = %for.end.loopexit, %entry ret void } diff --git a/llvm/test/Analysis/DependenceAnalysis/ZIV.ll b/llvm/test/Analysis/DependenceAnalysis/ZIV.ll index 42b2389..7b004be 100644 --- a/llvm/test/Analysis/DependenceAnalysis/ZIV.ll +++ b/llvm/test/Analysis/DependenceAnalysis/ZIV.ll @@ -5,49 +5,70 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3 target triple = "x86_64-apple-macosx10.6.0" -;; A[n + 1] = ... -;; ... = A[1 + n]; +;; A[n + 1] = 0; +;; *B = A[1 + n]; define void @z0(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp { entry: %add = add i64 %n, 1 %arrayidx = getelementptr inbounds i32* %A, i64 %add store i32 0, i32* %arrayidx, align 4 + +; CHECK: da analyze - consistent output! +; CHECK: da analyze - consistent flow! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + %add1 = add i64 %n, 1 %arrayidx2 = getelementptr inbounds i32* %A, i64 %add1 %0 = load i32* %arrayidx2, align 4 -; CHECK: da analyze - consistent flow! store i32 %0, i32* %B, align 4 ret void } -;; A[n] = ... -;; ... = A[n + 1]; +;; A[n] = 0; +;; *B = A[n + 1]; define void @z1(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp { entry: %arrayidx = getelementptr inbounds i32* %A, i64 %n store i32 0, i32* %arrayidx, align 4 + +; CHECK: da analyze - consistent output! +; CHECK: da analyze - none! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + %add = add i64 %n, 1 %arrayidx1 = getelementptr inbounds i32* %A, i64 %add %0 = load i32* %arrayidx1, align 4 -; CHECK: da analyze - none! store i32 %0, i32* %B, align 4 ret void } -;; A[n] = ... -;; ... = A[m]; +;; A[n] = 0; +;; *B = A[m]; define void @z2(i32* %A, i32* %B, i64 %n, i64 %m) nounwind uwtable ssp { entry: %arrayidx = getelementptr inbounds i32* %A, i64 %n store i32 0, i32* %arrayidx, align 4 + +; CHECK: da analyze - consistent output! +; CHECK: da analyze - flow! +; CHECK: da analyze - confused! +; CHECK: da analyze - consistent input! +; CHECK: da analyze - confused! +; CHECK: da analyze - confused! + %arrayidx1 = getelementptr inbounds i32* %A, i64 %m %0 = load i32* %arrayidx1, align 4 -; CHECK: da analyze - flow! store i32 %0, i32* %B, align 4 ret void }