Index: llvm/trunk/lib/Analysis/DependenceAnalysis.cpp =================================================================== --- llvm/trunk/lib/Analysis/DependenceAnalysis.cpp +++ llvm/trunk/lib/Analysis/DependenceAnalysis.cpp @@ -24,8 +24,7 @@ // Both of these are conservative weaknesses; // that is, not a source of correctness problems. // -// The implementation depends on the GEP instruction to differentiate -// subscripts. Since Clang linearizes some array subscripts, the dependence +// Since Clang linearizes some array subscripts, the dependence // analysis is using SCEV->delinearize to recover the representation of multiple // subscripts, and thus avoid the more expensive and less precise MIV tests. The // delinearization is controlled by the flag -da-delinearize. @@ -3329,50 +3328,18 @@ FullDependence Result(Src, Dst, PossiblyLoopIndependent, CommonLevels); ++TotalArrayPairs; - // See if there are GEPs we can use. - bool UsefulGEP = false; - GEPOperator *SrcGEP = dyn_cast(SrcPtr); - GEPOperator *DstGEP = dyn_cast(DstPtr); - if (SrcGEP && DstGEP && - SrcGEP->getPointerOperandType() == DstGEP->getPointerOperandType()) { - const SCEV *SrcPtrSCEV = SE->getSCEV(SrcGEP->getPointerOperand()); - const SCEV *DstPtrSCEV = SE->getSCEV(DstGEP->getPointerOperand()); - DEBUG(dbgs() << " SrcPtrSCEV = " << *SrcPtrSCEV << "\n"); - DEBUG(dbgs() << " DstPtrSCEV = " << *DstPtrSCEV << "\n"); - - UsefulGEP = isLoopInvariant(SrcPtrSCEV, LI->getLoopFor(Src->getParent())) && - isLoopInvariant(DstPtrSCEV, LI->getLoopFor(Dst->getParent())) && - (SrcGEP->getNumOperands() == DstGEP->getNumOperands()) && - isKnownPredicate(CmpInst::ICMP_EQ, SrcPtrSCEV, DstPtrSCEV); - } - unsigned Pairs = UsefulGEP ? SrcGEP->idx_end() - SrcGEP->idx_begin() : 1; - SmallVector Pair(Pairs); - if (UsefulGEP) { - DEBUG(dbgs() << " using GEPs\n"); - unsigned P = 0; - for (GEPOperator::const_op_iterator SrcIdx = SrcGEP->idx_begin(), - SrcEnd = SrcGEP->idx_end(), - DstIdx = DstGEP->idx_begin(); - SrcIdx != SrcEnd; - ++SrcIdx, ++DstIdx, ++P) { - Pair[P].Src = SE->getSCEV(*SrcIdx); - Pair[P].Dst = SE->getSCEV(*DstIdx); - unifySubscriptType(&Pair[P]); - } - } - else { - DEBUG(dbgs() << " ignoring GEPs\n"); - const SCEV *SrcSCEV = SE->getSCEV(SrcPtr); - const SCEV *DstSCEV = SE->getSCEV(DstPtr); - DEBUG(dbgs() << " SrcSCEV = " << *SrcSCEV << "\n"); - DEBUG(dbgs() << " DstSCEV = " << *DstSCEV << "\n"); - Pair[0].Src = SrcSCEV; - Pair[0].Dst = DstSCEV; - } + unsigned Pairs = 1; + SmallVector Pair(Pairs); + const SCEV *SrcSCEV = SE->getSCEV(SrcPtr); + const SCEV *DstSCEV = SE->getSCEV(DstPtr); + DEBUG(dbgs() << " SrcSCEV = " << *SrcSCEV << "\n"); + DEBUG(dbgs() << " DstSCEV = " << *DstSCEV << "\n"); + Pair[0].Src = SrcSCEV; + Pair[0].Dst = DstSCEV; - if (Delinearize && CommonLevels > 1) { + if (Delinearize) { if (tryDelinearize(Src, Dst, Pair)) { - DEBUG(dbgs() << " delinearized GEP\n"); + DEBUG(dbgs() << " delinearized\n"); Pairs = Pair.size(); } } @@ -3763,41 +3730,16 @@ FullDependence Result(Src, Dst, false, CommonLevels); - // See if there are GEPs we can use. - bool UsefulGEP = false; - GEPOperator *SrcGEP = dyn_cast(SrcPtr); - GEPOperator *DstGEP = dyn_cast(DstPtr); - if (SrcGEP && DstGEP && - SrcGEP->getPointerOperandType() == DstGEP->getPointerOperandType()) { - const SCEV *SrcPtrSCEV = SE->getSCEV(SrcGEP->getPointerOperand()); - const SCEV *DstPtrSCEV = SE->getSCEV(DstGEP->getPointerOperand()); - UsefulGEP = isLoopInvariant(SrcPtrSCEV, LI->getLoopFor(Src->getParent())) && - isLoopInvariant(DstPtrSCEV, LI->getLoopFor(Dst->getParent())) && - (SrcGEP->getNumOperands() == DstGEP->getNumOperands()); - } - unsigned Pairs = UsefulGEP ? SrcGEP->idx_end() - SrcGEP->idx_begin() : 1; - SmallVector Pair(Pairs); - if (UsefulGEP) { - unsigned P = 0; - for (GEPOperator::const_op_iterator SrcIdx = SrcGEP->idx_begin(), - SrcEnd = SrcGEP->idx_end(), - DstIdx = DstGEP->idx_begin(); - SrcIdx != SrcEnd; - ++SrcIdx, ++DstIdx, ++P) { - Pair[P].Src = SE->getSCEV(*SrcIdx); - Pair[P].Dst = SE->getSCEV(*DstIdx); - } - } - else { - const SCEV *SrcSCEV = SE->getSCEV(SrcPtr); - const SCEV *DstSCEV = SE->getSCEV(DstPtr); - Pair[0].Src = SrcSCEV; - Pair[0].Dst = DstSCEV; - } + unsigned Pairs = 1; + SmallVector Pair(Pairs); + const SCEV *SrcSCEV = SE->getSCEV(SrcPtr); + const SCEV *DstSCEV = SE->getSCEV(DstPtr); + Pair[0].Src = SrcSCEV; + Pair[0].Dst = DstSCEV; - if (Delinearize && CommonLevels > 1) { + if (Delinearize) { if (tryDelinearize(Src, Dst, Pair)) { - DEBUG(dbgs() << " delinearized GEP\n"); + DEBUG(dbgs() << " delinearized\n"); Pairs = Pair.size(); } } Index: llvm/trunk/lib/Transforms/Scalar/LoopInterchange.cpp =================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopInterchange.cpp +++ llvm/trunk/lib/Transforms/Scalar/LoopInterchange.cpp @@ -591,13 +591,13 @@ LoopInterchangeLegality LIL(OuterLoop, InnerLoop, SE, LI, DT, PreserveLCSSA, ORE); if (!LIL.canInterchangeLoops(InnerLoopId, OuterLoopId, DependencyMatrix)) { - DEBUG(dbgs() << "Not interchanging Loops. Cannot prove legality\n"); + DEBUG(dbgs() << "Not interchanging loops. Cannot prove legality.\n"); return false; } DEBUG(dbgs() << "Loops are legal to interchange\n"); LoopInterchangeProfitability LIP(OuterLoop, InnerLoop, SE, ORE); if (!LIP.isProfitable(InnerLoopId, OuterLoopId, DependencyMatrix)) { - DEBUG(dbgs() << "Interchanging loops not profitable\n"); + DEBUG(dbgs() << "Interchanging loops not profitable.\n"); return false; } @@ -611,7 +611,7 @@ LoopInterchangeTransform LIT(OuterLoop, InnerLoop, SE, LI, DT, LoopNestExit, LIL.hasInnerLoopReduction()); LIT.transform(); - DEBUG(dbgs() << "Loops interchanged\n"); + DEBUG(dbgs() << "Loops interchanged.\n"); return true; } }; Index: llvm/trunk/test/Analysis/DependenceAnalysis/Coupled.ll =================================================================== --- llvm/trunk/test/Analysis/DependenceAnalysis/Coupled.ll +++ llvm/trunk/test/Analysis/DependenceAnalysis/Coupled.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -analyze -basicaa -da | FileCheck %s +; RUN: opt < %s -analyze -basicaa -da -da-delinearize | FileCheck %s ; ModuleID = 'Coupled.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" @@ -13,6 +13,7 @@ entry: br label %for.body +; CHECK-LABEL: couple0 ; CHECK: da analyze - none! ; CHECK: da analyze - none! ; CHECK: da analyze - confused! @@ -49,6 +50,7 @@ entry: br label %for.body +; CHECK-LABEL: couple1 ; CHECK: da analyze - none! ; CHECK: da analyze - consistent flow [-9]! ; CHECK: da analyze - confused! @@ -85,8 +87,9 @@ entry: br label %for.body +; CHECK-LABEL: couple2 ; CHECK: da analyze - none! -; CHECK: da analyze - flow [*|<]! +; CHECK: da analyze - flow [<]! ; CHECK: da analyze - confused! ; CHECK: da analyze - none! ; CHECK: da analyze - confused! @@ -123,6 +126,7 @@ entry: br label %for.body +; CHECK-LABEL: couple3 ; CHECK: da analyze - none! ; CHECK: da analyze - none! ; CHECK: da analyze - confused! @@ -161,6 +165,7 @@ entry: br label %for.body +; CHECK-LABEL: couple4 ; CHECK: da analyze - none! ; CHECK: da analyze - flow [*|<]! ; CHECK: da analyze - confused! @@ -200,6 +205,7 @@ entry: br label %for.body +; CHECK-LABEL: couple5 ; CHECK: da analyze - none! ; CHECK: da analyze - none! ; CHECK: da analyze - confused! @@ -241,8 +247,9 @@ entry: br label %for.body +; CHECK-LABEL: couple6 ; CHECK: da analyze - none! -; CHECK: da analyze - flow [=|<]! +; CHECK: da analyze - flow [<]! ; CHECK: da analyze - confused! ; CHECK: da analyze - none! ; CHECK: da analyze - confused! @@ -277,6 +284,7 @@ entry: br label %for.body +; CHECK-LABEL: couple7 ; CHECK: da analyze - none! ; CHECK: da analyze - none! ; CHECK: da analyze - confused! @@ -313,6 +321,7 @@ entry: br label %for.body +; CHECK-LABEL: couple8 ; CHECK: da analyze - none! ; CHECK: da analyze - none! ; CHECK: da analyze - confused! @@ -350,6 +359,7 @@ entry: br label %for.body +; CHECK-LABEL: couple9 ; CHECK: da analyze - none! ; CHECK: da analyze - none! ; CHECK: da analyze - confused! @@ -387,9 +397,9 @@ entry: br label %for.body +; CHECK-LABEL: couple10 ; CHECK: da analyze - none! -; CHECK: da analyze - flow [>] splitable! -; CHECK: da analyze - split level = 1, iteration = 3! +; CHECK: da analyze - flow [>]! ; CHECK: da analyze - confused! ; CHECK: da analyze - none! ; CHECK: da analyze - confused! @@ -425,9 +435,9 @@ entry: br label %for.body +; CHECK-LABEL: couple11 ; CHECK: da analyze - none! -; CHECK: da analyze - flow [=|<] splitable! -; CHECK: da analyze - split level = 1, iteration = 9! +; CHECK: da analyze - flow [>]! ; CHECK: da analyze - confused! ; CHECK: da analyze - none! ; CHECK: da analyze - confused! @@ -463,9 +473,9 @@ entry: br label %for.body +; CHECK-LABEL: couple12 ; CHECK: da analyze - none! -; CHECK: da analyze - flow [<] splitable! -; CHECK: da analyze - split level = 1, iteration = 11! +; CHECK: da analyze - flow [>]! ; CHECK: da analyze - confused! ; CHECK: da analyze - none! ; CHECK: da analyze - confused! @@ -501,6 +511,7 @@ entry: br label %for.body +; CHECK-LABEL: couple13 ; CHECK: da analyze - none! ; CHECK: da analyze - none! ; CHECK: da analyze - confused! @@ -537,9 +548,9 @@ entry: br label %for.body +; CHECK-LABEL: couple14 ; CHECK: da analyze - none! -; CHECK: da analyze - flow [=|<] splitable! -; CHECK: da analyze - split level = 1, iteration = 9! +; CHECK: da analyze - flow [<]! ; CHECK: da analyze - confused! ; CHECK: da analyze - none! ; CHECK: da analyze - confused! @@ -575,6 +586,7 @@ entry: br label %for.body +; CHECK-LABEL: couple15 ; CHECK: da analyze - none! ; CHECK: da analyze - none! ; CHECK: da analyze - confused! Index: llvm/trunk/test/Analysis/DependenceAnalysis/ExactSIV.ll =================================================================== --- llvm/trunk/test/Analysis/DependenceAnalysis/ExactSIV.ll +++ llvm/trunk/test/Analysis/DependenceAnalysis/ExactSIV.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -analyze -basicaa -da | FileCheck %s +; RUN: opt < %s -analyze -basicaa -da -da-delinearize | FileCheck %s ; ModuleID = 'ExactSIV.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" @@ -13,8 +13,9 @@ entry: br label %for.body +; CHECK-LABEL: exact0 ; CHECK: da analyze - none! -; CHECK: da analyze - flow [<=|<]! +; CHECK: da analyze - flow [>]! ; CHECK: da analyze - confused! ; CHECK: da analyze - none! ; CHECK: da analyze - confused! @@ -50,6 +51,7 @@ entry: br label %for.body +; CHECK-LABEL: exact1 ; CHECK: da analyze - none! ; CHECK: da analyze - none! ; CHECK: da analyze - confused! @@ -88,6 +90,7 @@ entry: br label %for.body +; CHECK-LABEL: exact2 ; CHECK: da analyze - none! ; CHECK: da analyze - none! ; CHECK: da analyze - confused! @@ -124,8 +127,9 @@ entry: br label %for.body +; CHECK-LABEL: exact3 ; CHECK: da analyze - none! -; CHECK: da analyze - flow [>]! +; CHECK: da analyze - flow [<]! ; CHECK: da analyze - confused! ; CHECK: da analyze - none! ; CHECK: da analyze - confused! @@ -160,8 +164,9 @@ entry: br label %for.body +; CHECK-LABEL: exact4 ; CHECK: da analyze - none! -; CHECK: da analyze - flow [>]! +; CHECK: da analyze - flow [<]! ; CHECK: da analyze - confused! ; CHECK: da analyze - none! ; CHECK: da analyze - confused! @@ -196,8 +201,9 @@ entry: br label %for.body +; CHECK-LABEL: exact5 ; CHECK: da analyze - none! -; CHECK: da analyze - flow [=>|<]! +; CHECK: da analyze - flow [<]! ; CHECK: da analyze - confused! ; CHECK: da analyze - none! ; CHECK: da analyze - confused! @@ -232,8 +238,9 @@ entry: br label %for.body +; CHECK-LABEL: exact6 ; CHECK: da analyze - none! -; CHECK: da analyze - flow [=>|<]! +; CHECK: da analyze - flow [<]! ; CHECK: da analyze - confused! ; CHECK: da analyze - none! ; CHECK: da analyze - confused! @@ -268,8 +275,9 @@ entry: br label %for.body +; CHECK-LABEL: exact7 ; CHECK: da analyze - none! -; CHECK: da analyze - flow [*|<]! +; CHECK: da analyze - flow [<]! ; CHECK: da analyze - confused! ; CHECK: da analyze - none! ; CHECK: da analyze - confused! @@ -304,6 +312,7 @@ entry: br label %for.body +; CHECK-LABEL: exact8 ; CHECK: da analyze - none! ; CHECK: da analyze - none! ; CHECK: da analyze - confused! @@ -340,8 +349,9 @@ entry: br label %for.body +; CHECK-LABEL: exact9 ; CHECK: da analyze - none! -; CHECK: da analyze - flow [>]! +; CHECK: da analyze - flow [<]! ; CHECK: da analyze - confused! ; CHECK: da analyze - none! ; CHECK: da analyze - confused! @@ -376,8 +386,9 @@ entry: br label %for.body +; CHECK-LABEL: exact10 ; CHECK: da analyze - none! -; CHECK: da analyze - flow [>]! +; CHECK: da analyze - flow [<]! ; CHECK: da analyze - confused! ; CHECK: da analyze - none! ; CHECK: da analyze - confused! @@ -412,8 +423,9 @@ entry: br label %for.body +; CHECK-LABEL: exact11 ; CHECK: da analyze - none! -; CHECK: da analyze - flow [=>|<]! +; CHECK: da analyze - flow [<]! ; CHECK: da analyze - confused! ; CHECK: da analyze - none! ; CHECK: da analyze - confused! @@ -448,8 +460,9 @@ entry: br label %for.body +; CHECK-LABEL: exact12 ; CHECK: da analyze - none! -; CHECK: da analyze - flow [=>|<]! +; CHECK: da analyze - flow [<]! ; CHECK: da analyze - confused! ; CHECK: da analyze - none! ; CHECK: da analyze - confused! @@ -484,8 +497,9 @@ entry: br label %for.body +; CHECK-LABEL: exact13 ; CHECK: da analyze - none! -; CHECK: da analyze - flow [*|<]! +; CHECK: da analyze - flow [<]! ; CHECK: da analyze - confused! ; CHECK: da analyze - none! ; CHECK: da analyze - confused! Index: llvm/trunk/test/Analysis/DependenceAnalysis/GCD.ll =================================================================== --- llvm/trunk/test/Analysis/DependenceAnalysis/GCD.ll +++ llvm/trunk/test/Analysis/DependenceAnalysis/GCD.ll @@ -1,4 +1,3 @@ -; RUN: opt < %s -analyze -basicaa -da -da-delinearize=false | FileCheck %s ; RUN: opt < %s -analyze -basicaa -da -da-delinearize | FileCheck %s -check-prefix=DELIN ; ModuleID = 'GCD.bc' @@ -15,15 +14,7 @@ entry: br label %for.cond1.preheader -; CHECK: 'Dependence Analysis' for function 'gcd0' -; CHECK: da analyze - output [* *]! -; CHECK: da analyze - flow [=> *|<]! -; CHECK: da analyze - confused! -; CHECK: da analyze - input [* *]! -; CHECK: da analyze - confused! -; CHECK: da analyze - none! - -; DELIN: 'Dependence Analysis' for function 'gcd0' +; DELIN-LABEL: gcd0 ; DELIN: da analyze - output [* *]! ; DELIN: da analyze - flow [=> *|<]! ; DELIN: da analyze - confused! @@ -76,15 +67,7 @@ entry: br label %for.cond1.preheader -; CHECK: 'Dependence Analysis' for function 'gcd1' -; CHECK: da analyze - output [* *]! -; CHECK: da analyze - none! -; CHECK: da analyze - confused! -; CHECK: da analyze - input [* *]! -; CHECK: da analyze - confused! -; CHECK: da analyze - none! - -; DELIN: 'Dependence Analysis' for function 'gcd1' +; DELIN-LABEL: gcd1 ; DELIN: da analyze - output [* *]! ; DELIN: da analyze - none! ; DELIN: da analyze - confused! @@ -138,15 +121,7 @@ entry: br label %for.cond1.preheader -; CHECK: 'Dependence Analysis' for function 'gcd2' -; CHECK: da analyze - output [* *]! -; CHECK: da analyze - none! -; CHECK: da analyze - confused! -; CHECK: da analyze - input [* *]! -; CHECK: da analyze - confused! -; CHECK: da analyze - none! - -; DELIN: 'Dependence Analysis' for function 'gcd2' +; DELIN-LABEL: gcd2 ; DELIN: da analyze - output [* *]! ; DELIN: da analyze - none! ; DELIN: da analyze - confused! @@ -200,15 +175,7 @@ entry: br label %for.cond1.preheader -; CHECK: 'Dependence Analysis' for function 'gcd3' -; CHECK: da analyze - output [* *]! -; CHECK: da analyze - flow [<> *]! -; CHECK: da analyze - confused! -; CHECK: da analyze - input [* *]! -; CHECK: da analyze - confused! -; CHECK: da analyze - none! - -; DELIN: 'Dependence Analysis' for function 'gcd3' +; DELIN-LABEL: gcd3 ; DELIN: da analyze - output [* *]! ; DELIN: da analyze - flow [<> *]! ; DELIN: da analyze - confused! @@ -260,15 +227,7 @@ entry: br label %for.cond1.preheader -; CHECK: 'Dependence Analysis' for function 'gcd4' -; CHECK: da analyze - output [* *]! -; CHECK: da analyze - none! -; CHECK: da analyze - confused! -; CHECK: da analyze - input [* *]! -; CHECK: da analyze - confused! -; CHECK: da analyze - none! - -; DELIN: 'Dependence Analysis' for function 'gcd4' +; DELIN-LABEL: gcd4 ; DELIN: da analyze - none! ; DELIN: da analyze - none! ; DELIN: da analyze - confused! @@ -330,15 +289,7 @@ entry: br label %for.cond1.preheader -; CHECK: 'Dependence Analysis' for function 'gcd5' -; CHECK: da analyze - output [* *]! -; CHECK: da analyze - flow [<> *]! -; CHECK: da analyze - confused! -; CHECK: da analyze - input [* *]! -; CHECK: da analyze - confused! -; CHECK: da analyze - none! - -; DELIN: 'Dependence Analysis' for function 'gcd5' +; DELIN-LABEL: gcd5 ; DELIN: da analyze - none! ; DELIN: da analyze - flow [> *]! ; DELIN: da analyze - confused! @@ -401,15 +352,7 @@ %cmp4 = icmp sgt i64 %n, 0 br i1 %cmp4, label %for.cond1.preheader.preheader, label %for.end12 -; CHECK: 'Dependence Analysis' for function 'gcd6' -; CHECK: da analyze - output [* *]! -; CHECK: da analyze - none! -; CHECK: da analyze - confused! -; CHECK: da analyze - input [* *]! -; CHECK: da analyze - confused! -; CHECK: da analyze - output [* *]! - -; DELIN: 'Dependence Analysis' for function 'gcd6' +; DELIN-LABEL: gcd6 ; DELIN: da analyze - none! ; DELIN: da analyze - none! ; DELIN: da analyze - confused! @@ -481,15 +424,7 @@ %cmp4 = icmp sgt i32 %n, 0 br i1 %cmp4, label %for.cond1.preheader.preheader, label %for.end15 -; CHECK: 'Dependence Analysis' for function 'gcd7' -; CHECK: da analyze - output [* *]! -; CHECK: da analyze - flow [* *|<]! -; CHECK: da analyze - confused! -; CHECK: da analyze - input [* *]! -; CHECK: da analyze - confused! -; CHECK: da analyze - output [* *]! - -; DELIN: 'Dependence Analysis' for function 'gcd7' +; DELIN-LABEL: gcd7 ; DELIN: da analyze - output [* *]! ; DELIN: da analyze - flow [* *|<]! ; DELIN: da analyze - confused! @@ -573,17 +508,9 @@ %cmp4 = icmp sgt i32 %n, 0 br i1 %cmp4, label %for.cond1.preheader.preheader, label %for.end15 -; CHECK: 'Dependence Analysis' for function 'gcd8' -; CHECK: da analyze - output [* *]! -; CHECK: da analyze - none! -; CHECK: da analyze - confused! -; CHECK: da analyze - input [* *]! -; CHECK: da analyze - confused! -; CHECK: da analyze - output [* *]! - -; DELIN: 'Dependence Analysis' for function 'gcd8' +; DELIN-LABEL: gcd8 ; DELIN: da analyze - output [* *]! -; DELIN: da analyze - none! +; DELIN: da analyze - flow [* *|<]! ; DELIN: da analyze - confused! ; DELIN: da analyze - input [* *]! ; DELIN: da analyze - confused! @@ -660,15 +587,7 @@ %cmp4 = icmp eq i32 %n, 0 br i1 %cmp4, label %for.end15, label %for.cond1.preheader.preheader -; CHECK: 'Dependence Analysis' for function 'gcd9' -; CHECK: da analyze - output [* *]! -; CHECK: da analyze - flow [* *|<]! -; CHECK: da analyze - confused! -; CHECK: da analyze - input [* *]! -; CHECK: da analyze - confused! -; CHECK: da analyze - output [* *]! - -; DELIN: 'Dependence Analysis' for function 'gcd9' +; DELIN-LABEL: gcd9 ; DELIN: da analyze - output [* *]! ; DELIN: da analyze - flow [* *|<]! ; DELIN: da analyze - confused! Index: llvm/trunk/test/Analysis/DependenceAnalysis/Invariant.ll =================================================================== --- llvm/trunk/test/Analysis/DependenceAnalysis/Invariant.ll +++ llvm/trunk/test/Analysis/DependenceAnalysis/Invariant.ll @@ -1,10 +1,11 @@ -; RUN: opt < %s -analyze -basicaa -da | FileCheck %s +; RUN: opt < %s -analyze -basicaa -da -da-delinearize | FileCheck %s ; Test for a bug, which caused an assert when an invalid ; SCEVAddRecExpr is created in addToCoefficient. +; CHECK-LABEL: foo ; CHECK: da analyze - consistent input [S 0]! -; CHECK: da analyze - input [* 0|<]! +; CHECK: da analyze - input [* *|<]! ; CHECK: da analyze - none! define float @foo(float %g, [40 x float]* %rr) nounwind { Index: llvm/trunk/test/Analysis/DependenceAnalysis/NonCanonicalizedSubscript.ll =================================================================== --- llvm/trunk/test/Analysis/DependenceAnalysis/NonCanonicalizedSubscript.ll +++ llvm/trunk/test/Analysis/DependenceAnalysis/NonCanonicalizedSubscript.ll @@ -1,4 +1,3 @@ -; RUN: opt < %s -analyze -basicaa -da -da-delinearize=false | FileCheck %s ; RUN: opt < %s -analyze -basicaa -da -da-delinearize | FileCheck %s -check-prefix=DELIN target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" @@ -13,15 +12,11 @@ ; other subscript. DependenceAnalysis before the fix crashed due to this ; mismatch. define void @i32_subscript([100 x [100 x i32]]* %a, i32* %b) { -; CHECK-LABEL: 'Dependence Analysis' for function 'i32_subscript' ; DELIN-LABEL: 'Dependence Analysis' for function 'i32_subscript' entry: br label %for.body for.body: -; CHECK: da analyze - none! -; CHECK: da analyze - anti [=|<]! -; CHECK: da analyze - none! ; DELIN: da analyze - none! ; DELIN: da analyze - anti [=|<]! ; DELIN: da analyze - none! @@ -55,16 +50,12 @@ ; Function Attrs: nounwind uwtable define void @coupled_miv_type_mismatch(i32 %n) #0 { -; CHECK-LABEL: 'Dependence Analysis' for function 'coupled_miv_type_mismatch' ; DELIN-LABEL: 'Dependence Analysis' for function 'coupled_miv_type_mismatch' entry: br label %for.cond -; CHECK: da analyze - input [0 *]! -; CHECK: da analyze - anti [1 *]! -; CHECK: da analyze - none! -; DELIN: da analyze - input [0 *]! -; DELIN: da analyze - anti [1 *]! +; DELIN: da analyze - input [* *]! +; DELIN: da analyze - anti [* *|<]! ; DELIN: da analyze - none! for.cond: ; preds = %for.inc11, %entry %indvars.iv11 = phi i64 [ %indvars.iv.next12, %for.inc11 ], [ 1, %entry ] Index: llvm/trunk/test/Analysis/DependenceAnalysis/Preliminary.ll =================================================================== --- llvm/trunk/test/Analysis/DependenceAnalysis/Preliminary.ll +++ llvm/trunk/test/Analysis/DependenceAnalysis/Preliminary.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -analyze -basicaa -da | FileCheck %s +; RUN: opt < %s -analyze -basicaa -da -da-delinearize | 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" @@ -13,6 +13,7 @@ entry: store i32 %n, i32* %A, align 4 +; CHECK-LABEL: p0 ; CHECK: da analyze - none! ; CHECK: da analyze - confused! ; CHECK: da analyze - none! @@ -31,6 +32,7 @@ entry: store i32 %n, i32* %A, align 4 +; CHECK-LABEL: p1 ; CHECK: da analyze - none! ; CHECK: da analyze - none! ; CHECK: da analyze - none! @@ -54,10 +56,11 @@ %cmp10 = icmp sgt i64 %n, 0 br i1 %cmp10, label %for.cond1.preheader.preheader, label %for.end26 -; CHECK: da analyze - none! -; CHECK: da analyze - flow [-3 -2]! +; CHECK-LABEL: p2 +; CHECK: da analyze - output [* * *]! +; CHECK: da analyze - flow [* *|<]! ; CHECK: da analyze - confused! -; CHECK: da analyze - none! +; CHECK: da analyze - input [* * *]! ; CHECK: da analyze - confused! ; CHECK: da analyze - output [* * *]! @@ -142,6 +145,7 @@ } +; This ridiculous example is disabled: it does not make sense to keep it. ;; for (long int i = 0; i < n; i++) ;; for (long int j = 0; j < n; j++) ;; for (long int k = 0; k < n; k++) @@ -157,262 +161,262 @@ ;; 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.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 - output [* * * * * * * * * * * *]! - -for.cond1.preheader.preheader: ; preds = %entry - br label %for.cond1.preheader - -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.preheader, label %for.inc88 - -for.cond4.preheader.preheader: ; preds = %for.cond1.preheader - br label %for.cond4.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.preheader, label %for.inc85 - -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.preheader, label %for.inc82 - -for.cond10.preheader.preheader: ; preds = %for.cond7.preheader - br label %for.cond10.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.preheader, label %for.inc79 - -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.preheader, label %for.inc76 - -for.cond16.preheader.preheader: ; preds = %for.cond13.preheader - br label %for.cond16.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.preheader, label %for.inc73 - -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.preheader, label %for.inc70 - -for.cond22.preheader.preheader: ; preds = %for.cond19.preheader - br label %for.cond22.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.preheader, label %for.inc67 - -for.cond25.preheader.preheader: ; preds = %for.cond22.preheader - br label %for.cond25.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.preheader, label %for.inc64 - -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.preheader, label %for.inc61 - -for.cond31.preheader.preheader: ; preds = %for.cond28.preheader - br label %for.cond31.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.preheader, label %for.inc58 - -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 - %add3547 = or i64 %mul, 1 - %sub = add nsw i64 %k.037, -1 - %sub36 = add nsw i64 %i.045, -3 - %arrayidx43 = getelementptr inbounds [100 x [100 x [100 x [100 x [100 x [100 x [100 x i64]]]]]]], [100 x [100 x [100 x [100 x [100 x [100 x [100 x i64]]]]]]]* %A, i64 %sub36, i64 %j.041, i64 2, i64 %sub, i64 %add3547, i64 %m.029, i64 %add34, i64 %add - store i64 %i.045, i64* %arrayidx43, align 8 - %add44 = add nsw i64 %t.03, 2 - %add45 = add nsw i64 %n, 1 - %mul46 = mul nsw i64 %l.033, 3 - %sub47 = add nsw i64 %mul46, -1 - %sub48 = sub nsw i64 1, %k.037 - %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]]]]]]], [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, i64* %arrayidx57, align 8 - %incdec.ptr = getelementptr inbounds i64, i64* %B.addr.112, i64 1 - store i64 %0, i64* %B.addr.112, align 8 - %inc = add nsw i64 %t.03, 1 - %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, i64* %B.addr.105, i64 %n - br label %for.inc58 - -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 - %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.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 - %exitcond49 = icmp ne i64 %inc62, %n - br i1 %exitcond49, label %for.cond28.preheader, label %for.inc64.loopexit - -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 - %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.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 - %exitcond51 = icmp ne i64 %inc68, %n - br i1 %exitcond51, label %for.cond22.preheader, label %for.inc70.loopexit - -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 - %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.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 - %exitcond53 = icmp ne i64 %inc74, %n - br i1 %exitcond53, label %for.cond16.preheader, label %for.inc76.loopexit - -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 - %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.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 - %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.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 - %exitcond56 = icmp ne i64 %inc83, %n - br i1 %exitcond56, label %for.cond7.preheader, label %for.inc85.loopexit - -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 - %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.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 - %exitcond58 = icmp ne i64 %inc89, %n - br i1 %exitcond58, label %for.cond1.preheader, label %for.end90.loopexit - -for.end90.loopexit: ; preds = %for.inc88 - br label %for.end90 - -for.end90: ; preds = %for.end90.loopexit, %entry - ret void -} +;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.preheader, label %for.end90 +; +;; DONT-CHECK-LABEL: p3 +;; DONT-CHECK: da analyze - output [* * * * * S * * * * S S]! +;; DONT-CHECK: da analyze - flow [* * * * * * * * * * * *|<]! +;; DONT-CHECK: da analyze - confused! +;; DONT-CHECK: da analyze - input [* S * * S * S S S S * *]! +;; DONT-CHECK: da analyze - confused! +;; DONT-CHECK: da analyze - output [* * * * * * * * * * * *]! +; +;for.cond1.preheader.preheader: ; preds = %entry +; br label %for.cond1.preheader +; +;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.preheader, label %for.inc88 +; +;for.cond4.preheader.preheader: ; preds = %for.cond1.preheader +; br label %for.cond4.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.preheader, label %for.inc85 +; +;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.preheader, label %for.inc82 +; +;for.cond10.preheader.preheader: ; preds = %for.cond7.preheader +; br label %for.cond10.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.preheader, label %for.inc79 +; +;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.preheader, label %for.inc76 +; +;for.cond16.preheader.preheader: ; preds = %for.cond13.preheader +; br label %for.cond16.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.preheader, label %for.inc73 +; +;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.preheader, label %for.inc70 +; +;for.cond22.preheader.preheader: ; preds = %for.cond19.preheader +; br label %for.cond22.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.preheader, label %for.inc67 +; +;for.cond25.preheader.preheader: ; preds = %for.cond22.preheader +; br label %for.cond25.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.preheader, label %for.inc64 +; +;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.preheader, label %for.inc61 +; +;for.cond31.preheader.preheader: ; preds = %for.cond28.preheader +; br label %for.cond31.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.preheader, label %for.inc58 +; +;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 +; %add3547 = or i64 %mul, 1 +; %sub = add nsw i64 %k.037, -1 +; %sub36 = add nsw i64 %i.045, -3 +; %arrayidx43 = getelementptr inbounds [100 x [100 x [100 x [100 x [100 x [100 x [100 x i64]]]]]]], [100 x [100 x [100 x [100 x [100 x [100 x [100 x i64]]]]]]]* %A, i64 %sub36, i64 %j.041, i64 2, i64 %sub, i64 %add3547, i64 %m.029, i64 %add34, i64 %add +; store i64 %i.045, i64* %arrayidx43, align 8 +; %add44 = add nsw i64 %t.03, 2 +; %add45 = add nsw i64 %n, 1 +; %mul46 = mul nsw i64 %l.033, 3 +; %sub47 = add nsw i64 %mul46, -1 +; %sub48 = sub nsw i64 1, %k.037 +; %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]]]]]]], [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, i64* %arrayidx57, align 8 +; %incdec.ptr = getelementptr inbounds i64, i64* %B.addr.112, i64 1 +; store i64 %0, i64* %B.addr.112, align 8 +; %inc = add nsw i64 %t.03, 1 +; %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, i64* %B.addr.105, i64 %n +; br label %for.inc58 +; +;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 +; %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.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 +; %exitcond49 = icmp ne i64 %inc62, %n +; br i1 %exitcond49, label %for.cond28.preheader, label %for.inc64.loopexit +; +;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 +; %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.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 +; %exitcond51 = icmp ne i64 %inc68, %n +; br i1 %exitcond51, label %for.cond22.preheader, label %for.inc70.loopexit +; +;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 +; %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.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 +; %exitcond53 = icmp ne i64 %inc74, %n +; br i1 %exitcond53, label %for.cond16.preheader, label %for.inc76.loopexit +; +;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 +; %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.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 +; %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.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 +; %exitcond56 = icmp ne i64 %inc83, %n +; br i1 %exitcond56, label %for.cond7.preheader, label %for.inc85.loopexit +; +;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 +; %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.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 +; %exitcond58 = icmp ne i64 %inc89, %n +; br i1 %exitcond58, label %for.cond1.preheader, label %for.end90.loopexit +; +;for.end90.loopexit: ; preds = %for.inc88 +; br label %for.end90 +; +;for.end90: ; preds = %for.end90.loopexit, %entry +; ret void +;} ;;void p4(int *A, int *B, long int n) { @@ -425,10 +429,11 @@ %cmp1 = icmp sgt i64 %n, 0 br i1 %cmp1, label %for.body.preheader, label %for.end +; CHECK-LABEL: p4 ; CHECK: da analyze - output [*]! ; CHECK: da analyze - flow [*|<]! ; CHECK: da analyze - confused! -; CHECK: da analyze - none! +; CHECK: da analyze - input [*]! ; CHECK: da analyze - confused! ; CHECK: da analyze - none! @@ -471,10 +476,11 @@ %cmp1 = icmp sgt i64 %n, 0 br i1 %cmp1, label %for.body.preheader, label %for.end +; CHECK-LABEL: p5 ; CHECK: da analyze - output [*]! ; CHECK: da analyze - flow [*|<]! ; CHECK: da analyze - confused! -; CHECK: da analyze - none! +; CHECK: da analyze - input [*]! ; CHECK: da analyze - confused! ; CHECK: da analyze - none! @@ -517,6 +523,7 @@ %cmp1 = icmp sgt i64 %n, 0 br i1 %cmp1, label %for.body.preheader, label %for.end +; CHECK-LABEL: p6 ; CHECK: da analyze - none! ; CHECK: da analyze - consistent flow [2]! ; CHECK: da analyze - confused! @@ -559,6 +566,7 @@ %idxprom = sext i8 %n to i64 %arrayidx = getelementptr inbounds i32, i32* %A, i64 %idxprom +; CHECK-LABEL: p7 ; CHECK: da analyze - none! ; CHECK: da analyze - none! ; CHECK: da analyze - confused! @@ -586,6 +594,7 @@ %arrayidx = getelementptr inbounds i32, i32* %A, i64 %idxprom store i32 0, i32* %arrayidx, align 4 +; CHECK-LABEL: p8 ; CHECK: da analyze - none! ; CHECK: da analyze - none! ; CHECK: da analyze - confused! @@ -612,8 +621,9 @@ %arrayidx = getelementptr inbounds i32, i32* %A, i64 %idxprom store i32 0, i32* %arrayidx, align 4 +; CHECK-LABEL: p9 ; CHECK: da analyze - none! -; CHECK: da analyze - none! +; CHECK: da analyze - flow [|<]! ; CHECK: da analyze - confused! ; CHECK: da analyze - none! ; CHECK: da analyze - confused! @@ -638,8 +648,9 @@ %arrayidx = getelementptr inbounds i32, i32* %A, i64 %idxprom store i32 0, i32* %arrayidx, align 4 +; CHECK-LABEL: p10 ; CHECK: da analyze - none! -; CHECK: da analyze - none! +; CHECK: da analyze - flow [|<]! ; CHECK: da analyze - confused! ; CHECK: da analyze - none! ; CHECK: da analyze - confused! @@ -664,7 +675,7 @@ %struct.S = type { i32 } -define void @f(%struct.S* %s, i32 %size) nounwind uwtable ssp { +define void @foo(%struct.S* %s, i32 %size) nounwind uwtable ssp { entry: %idx.ext = zext i32 %size to i64 %add.ptr.sum = add i64 %idx.ext, -1 @@ -672,6 +683,7 @@ %cmp1 = icmp eq i64 %add.ptr.sum, 0 br i1 %cmp1, label %while.end, label %while.body.preheader +; CHECK-LABEL: foo ; CHECK: da analyze - none! ; CHECK: da analyze - consistent anti [1]! ; CHECK: da analyze - none! Index: llvm/trunk/test/Analysis/DependenceAnalysis/Propagating.ll =================================================================== --- llvm/trunk/test/Analysis/DependenceAnalysis/Propagating.ll +++ llvm/trunk/test/Analysis/DependenceAnalysis/Propagating.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -analyze -basicaa -da | FileCheck %s +; RUN: opt < %s -analyze -basicaa -da -da-delinearize | FileCheck %s ; ModuleID = 'Propagating.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" @@ -14,8 +14,9 @@ entry: br label %for.cond1.preheader +; CHECK-LABEL: prop0 ; CHECK: da analyze - none! -; CHECK: da analyze - consistent flow [1 -1]! +; CHECK: da analyze - flow [< >]! ; CHECK: da analyze - confused! ; CHECK: da analyze - none! ; CHECK: da analyze - confused! @@ -64,10 +65,11 @@ entry: br label %for.cond1.preheader -; CHECK: da analyze - none! -; CHECK: da analyze - consistent flow [1 1 -1]! +; CHECK-LABEL: prop1 +; CHECK: da analyze - output [* * *]! +; CHECK: da analyze - flow [<> <> *]! ; CHECK: da analyze - confused! -; CHECK: da analyze - none! +; CHECK: da analyze - input [* * *]! ; CHECK: da analyze - confused! ; CHECK: da analyze - none! @@ -126,8 +128,9 @@ entry: br label %for.cond1.preheader +; CHECK-LABEL: prop2 ; CHECK: da analyze - consistent output [0 S]! -; CHECK: da analyze - none! +; CHECK: da analyze - flow [> *]! ; CHECK: da analyze - confused! ; CHECK: da analyze - none! ; CHECK: da analyze - confused! @@ -176,10 +179,11 @@ entry: br label %for.cond1.preheader -; CHECK: da analyze - none! -; CHECK: da analyze - none! +; CHECK-LABEL: prop3 +; CHECK: da analyze - output [* *]! +; CHECK: da analyze - flow [<> *]! ; CHECK: da analyze - confused! -; CHECK: da analyze - none! +; CHECK: da analyze - input [* *]! ; CHECK: da analyze - confused! ; CHECK: da analyze - none! @@ -227,8 +231,9 @@ entry: br label %for.cond1.preheader +; CHECK-LABEL: prop4 ; CHECK: da analyze - none! -; CHECK: da analyze - consistent flow [2 -3]! +; CHECK: da analyze - flow [< <>]! ; CHECK: da analyze - confused! ; CHECK: da analyze - none! ; CHECK: da analyze - confused! @@ -279,9 +284,9 @@ entry: br label %for.cond1.preheader +; CHECK-LABEL: prop5 ; CHECK: da analyze - none! -; CHECK: da analyze - flow [< -16] splitable! -; CHECK: da analyze - split level = 1, iteration = 11! +; CHECK: da analyze - flow [* *|<]! ; CHECK: da analyze - confused! ; CHECK: da analyze - none! ; CHECK: da analyze - confused! @@ -333,8 +338,9 @@ entry: br label %for.cond1.preheader +; CHECK-LABEL: prop6 ; CHECK: da analyze - none! -; CHECK: da analyze - flow [=> -2]! +; CHECK: da analyze - flow [=> <>]! ; CHECK: da analyze - confused! ; CHECK: da analyze - none! ; CHECK: da analyze - confused! @@ -386,9 +392,9 @@ entry: br label %for.cond1.preheader +; CHECK-LABEL: prop7 ; CHECK: da analyze - none! -; CHECK: da analyze - flow [* -38] splitable! -; CHECK: da analyze - split level = 1, iteration = 4! +; CHECK: da analyze - flow [* <>]! ; CHECK: da analyze - confused! ; CHECK: da analyze - none! ; CHECK: da analyze - confused! @@ -442,8 +448,9 @@ entry: br label %for.cond1.preheader +; CHECK-LABEL: prop8 ; CHECK: da analyze - consistent output [S 0]! -; CHECK: da analyze - flow [p<= 2]! +; CHECK: da analyze - flow [=> <]! ; CHECK: da analyze - confused! ; CHECK: da analyze - none! ; CHECK: da analyze - confused! @@ -493,8 +500,9 @@ entry: br label %for.cond1.preheader +; CHECK-LABEL: prop9 ; CHECK: da analyze - none! -; CHECK: da analyze - flow [p<= 2]! +; CHECK: da analyze - flow [<= <]! ; CHECK: da analyze - confused! ; CHECK: da analyze - consistent input [S 0]! ; CHECK: da analyze - confused! Index: llvm/trunk/test/Analysis/DependenceAnalysis/Separability.ll =================================================================== --- llvm/trunk/test/Analysis/DependenceAnalysis/Separability.ll +++ llvm/trunk/test/Analysis/DependenceAnalysis/Separability.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -analyze -basicaa -da | FileCheck %s +; RUN: opt < %s -analyze -basicaa -da -da-delinearize | FileCheck %s ; ModuleID = 'Separability.bc' target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" @@ -16,10 +16,10 @@ entry: br label %for.cond1.preheader -; CHECK: da analyze - output [0 * * S]! -; CHECK: da analyze - flow [-10 * * *]! +; CHECK: da analyze - output [= * * S]! +; CHECK: da analyze - flow [* * * *|<]! ; CHECK: da analyze - confused! -; CHECK: da analyze - input [0 * S *]! +; CHECK: da analyze - input [* * S *]! ; CHECK: da analyze - confused! ; CHECK: da analyze - none! @@ -91,10 +91,10 @@ entry: br label %for.cond1.preheader -; CHECK: da analyze - output [0 * * S]! -; CHECK: da analyze - flow [> * * *]! +; CHECK: da analyze - output [= * * S]! +; CHECK: da analyze - flow [* * * *|<]! ; CHECK: da analyze - confused! -; CHECK: da analyze - input [0 * S *]! +; CHECK: da analyze - input [* * S *]! ; CHECK: da analyze - confused! ; CHECK: da analyze - none! @@ -165,10 +165,10 @@ entry: br label %for.cond1.preheader -; CHECK: da analyze - consistent output [0 S 0 0]! -; CHECK: da analyze - flow [> * * -10]! +; CHECK: da analyze - output [= S = =]! +; CHECK: da analyze - flow [* * * <>]! ; CHECK: da analyze - confused! -; CHECK: da analyze - input [0 * * 0]! +; CHECK: da analyze - input [= * * *]! ; CHECK: da analyze - confused! ; CHECK: da analyze - none! @@ -239,10 +239,10 @@ entry: br label %for.cond1.preheader -; CHECK: da analyze - consistent output [0 S 0 0]! -; CHECK: da analyze - flow [> * * *]! +; CHECK: da analyze - output [= S = =]! +; CHECK: da analyze - flow [* * * *|<]! ; CHECK: da analyze - confused! -; CHECK: da analyze - input [0 * * 0]! +; CHECK: da analyze - input [= * * *]! ; CHECK: da analyze - confused! ; CHECK: da analyze - none! Index: llvm/trunk/test/Analysis/DependenceAnalysis/StrongSIV.ll =================================================================== --- llvm/trunk/test/Analysis/DependenceAnalysis/StrongSIV.ll +++ llvm/trunk/test/Analysis/DependenceAnalysis/StrongSIV.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -analyze -basicaa -da | FileCheck %s +; RUN: opt < %s -analyze -basicaa -da -da-delinearize | 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" @@ -328,7 +328,7 @@ br label %for.body ; CHECK: da analyze - none! -; CHECK: da analyze - consistent flow [%n|<]! +; CHECK: da analyze - flow [*|<]! ; CHECK: da analyze - confused! ; CHECK: da analyze - none! ; CHECK: da analyze - confused! Index: llvm/trunk/test/Analysis/DependenceAnalysis/SymbolicSIV.ll =================================================================== --- llvm/trunk/test/Analysis/DependenceAnalysis/SymbolicSIV.ll +++ llvm/trunk/test/Analysis/DependenceAnalysis/SymbolicSIV.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -analyze -basicaa -da | FileCheck %s +; RUN: opt < %s -analyze -basicaa -da -da-delinearize | FileCheck %s ; ModuleID = 'SymbolicSIV.bc' target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" @@ -291,7 +291,7 @@ ; CHECK: da analyze - none! ; CHECK: da analyze - flow [*|<] splitable! -; CHECK: da analyze - split level = 1, iteration = ((0 smax (-1 + (-1 * %n))) /u 2)! +; CHECK: da analyze - split level = 1, iteration = ((0 smax (-4 + (-4 * %n))) /u 8)! ; CHECK: da analyze - confused! ; CHECK: da analyze - none! ; CHECK: da analyze - confused! @@ -334,8 +334,9 @@ %cmp1 = icmp eq i64 %n, 0 br i1 %cmp1, label %for.end, label %for.body.preheader +; CHECK-LABEL: symbolicsiv6 ; CHECK: da analyze - none! -; CHECK: da analyze - none! +; CHECK: da analyze - flow [0|<]! ; CHECK: da analyze - confused! ; CHECK: da analyze - none! ; CHECK: da analyze - confused! @@ -382,9 +383,9 @@ entry: %cmp1 = icmp eq i64 %n, 0 br i1 %cmp1, label %for.end, label %for.body.preheader - +; CHECK-LABEL: symbolicsiv7 ; CHECK: da analyze - none! -; CHECK: da analyze - flow [<>]! +; CHECK: da analyze - flow [0|<]! ; CHECK: da analyze - confused! ; CHECK: da analyze - none! ; CHECK: da analyze - confused! Index: llvm/trunk/test/Transforms/LoopInterchange/call-instructions.ll =================================================================== --- llvm/trunk/test/Transforms/LoopInterchange/call-instructions.ll +++ llvm/trunk/test/Transforms/LoopInterchange/call-instructions.ll @@ -1,5 +1,5 @@ -; RUN: opt < %s -basicaa -loop-interchange -verify-dom-info -S | FileCheck %s -;; We test the complete .ll for adjustment in outer loop header/latch and inner loop header/latch. +; REQUIRES: asserts +; RUN: opt < %s -basicaa -loop-interchange -verify-dom-info -S -debug 2>&1 | FileCheck %s target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" @@ -20,6 +20,8 @@ ;; } ;; } +; CHECK: Not interchanging loops. Cannot prove legality. + define void @interchange_01(i32 %k, i32 %N) { entry: %cmp21 = icmp sgt i32 %N, 0 @@ -65,24 +67,6 @@ ret void } -; CHECK-LABEL: @interchange_01 -; CHECK: for1.ph: -; CHECK: br label %for1.header - -; CHECK: for1.header: -; CHECK-NEXT: %indvars.iv23 = phi i64 [ 0, %for1.ph ], [ %indvars.iv.next24, %for1.inc10 ] -; CHECK-NEXT: br i1 %cmp219, label %for2.ph, label %for1.inc10 - -; CHECK: for2: -; CHECK: br i1 %exitcond, label %for2.loopexit, label %for2 - -; CHECK: for1.inc10: -; CHECK: br i1 %exitcond26, label %for1.loopexit, label %for1.header - -; CHECK: for1.loopexit: -; CHECK-NEXT: br label %exit - - ;;--------------------------------------Test case 02------------------------------------ ;; Safe to interchange, because the called function `bar` is marked as readnone, ;; so it cannot introduce dependences. @@ -94,6 +78,8 @@ ;; } ;; } +; CHECK: Not interchanging loops. Cannot prove legality. + define void @interchange_02(i32 %k, i32 %N) { entry: %cmp21 = icmp sgt i32 %N, 0 @@ -138,21 +124,3 @@ exit: ret void } - -; CHECK-LABEL: @interchange_02 -; CHECK: for1.header: -; CHECK-NEXT: %indvars.iv23 = phi i64 [ 0, %for1.ph ], [ %indvars.iv.next24, %for1.inc10 ] -; CHECK-NEXT: br i1 %cmp219, label %for2.split1, label %for1.loopexit - -; CHECK: for2.split1: -; CHECK: br label %for2.loopexit - -; CHECK: for2.split: -; CHECK-NEXT: %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 -; CHECK: br i1 %exitcond, label %for1.loopexit, label %for2 - -; CHECK: for2.loopexit: -; CHECK-NEXT: br label %for1.inc10 - -; CHECK: for1.inc10: -; CHECK: br i1 %exitcond26, label %for2.split, label %for1.header Index: llvm/trunk/test/Transforms/LoopInterchange/current-limitations-lcssa.ll =================================================================== --- llvm/trunk/test/Transforms/LoopInterchange/current-limitations-lcssa.ll +++ llvm/trunk/test/Transforms/LoopInterchange/current-limitations-lcssa.ll @@ -1,5 +1,5 @@ -; RUN: opt < %s -basicaa -loop-interchange -S | FileCheck %s -;; We test the complete .ll for adjustment in outer loop header/latch and inner loop header/latch. +; REQUIRES: asserts +; RUN: opt < %s -basicaa -loop-interchange -S -debug 2>&1 | FileCheck %s target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" @@ -13,6 +13,8 @@ ;; for(gj=1;gj&1 | FileCheck %s target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" @@ -14,6 +14,8 @@ ;; for(int j=1;j&1 | FileCheck %s target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" @@ -20,6 +20,12 @@ ;; fn2(T[k]); ;; } +; CHECK: Processing Inner Loop Id = 2 and OuterLoopId = 1 +; CHECK: Loops interchanged. + +; CHECK: Processing Inner Loop Id = 1 and OuterLoopId = 0 +; CHECK: Not interchanging loops. Cannot prove legality. + @T = internal global [100 x double] zeroinitializer, align 4 @Arr = internal global [1000 x [1000 x i32]] zeroinitializer, align 4 @@ -67,52 +73,3 @@ declare double @fn1() readnone declare void @fn2(double) readnone - - -;; After interchange %indvars.iv (j) should increment as the middle loop. -;; After interchange %indvars.iv42 (i) should increment with the inner most loop. - -; CHECK-LABEL: @interchange_09 - -; CHECK: for.body: -; CHECK: %indvars.iv45 = phi i64 [ %indvars.iv.next46, %for.cond.cleanup4 ], [ 0, %for.body.preheader ] -; CHECK: %call = call double @fn1() -; CHECK: %arrayidx = getelementptr inbounds [100 x double], [100 x double]* @T, i64 0, i64 %indvars.iv45 -; CHECK: store double %call, double* %arrayidx, align 8 -; CHECK: br label %for.body9.preheader - -; CHECK: for.cond6.preheader.preheader: -; CHECK: br label %for.cond6.preheader - -; CHECK: for.cond6.preheader: -; CHECK: %indvars.iv42 = phi i64 [ %indvars.iv.next43, %for.cond.cleanup8 ], [ 0, %for.cond6.preheader.preheader ] -; CHECK: br label %for.body9.split1 - -; CHECK: for.body9.preheader: -; CHECK: br label %for.body9 - -; CHECK: for.cond.cleanup4: -; CHECK: %tmp = load double, double* %arrayidx, align 8 -; CHECK: call void @fn2(double %tmp) -; CHECK: %indvars.iv.next46 = add nuw nsw i64 %indvars.iv45, 1 -; CHECK: %exitcond47 = icmp ne i64 %indvars.iv.next46, 100 -; CHECK: br i1 %exitcond47, label %for.body, label %for.cond.cleanup - -; CHECK: for.cond.cleanup8: -; CHECK: %indvars.iv.next43 = add nuw nsw i64 %indvars.iv42, 1 -; CHECK: %exitcond44 = icmp ne i64 %indvars.iv.next43, 1000 -; CHECK: br i1 %exitcond44, label %for.cond6.preheader, label %for.body9.split - -; CHECK: for.body9: -; CHECK: %indvars.iv = phi i64 [ %indvars.iv.next, %for.body9.split ], [ 1, %for.body9.preheader ] -; CHECK: br label %for.cond6.preheader.preheader - -; CHECK: for.body9.split1: -; CHECK: %arrayidx13 = getelementptr inbounds [1000 x [1000 x i32]], [1000 x [1000 x i32]]* @Arr, i64 0, i64 %indvars.iv, i64 %indvars.iv42 -; CHECK: store i32 %add, i32* %arrayidx13, align 4 -; CHECK: br label %for.cond.cleanup8 - -; CHECK: for.body9.split: -; CHECK: %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 -; CHECK: %exitcond = icmp ne i64 %indvars.iv.next, 1000 -; CHECK: br i1 %exitcond, label %for.body9, label %for.cond.cleanup4 Index: llvm/trunk/test/Transforms/LoopInterchange/interchange-insts-between-indvar.ll =================================================================== --- llvm/trunk/test/Transforms/LoopInterchange/interchange-insts-between-indvar.ll +++ llvm/trunk/test/Transforms/LoopInterchange/interchange-insts-between-indvar.ll @@ -1,8 +1,8 @@ -; RUN: opt < %s -basicaa -loop-interchange -verify-dom-info -S | FileCheck %s +; RUN: opt < %s -basicaa -da-delinearize -loop-interchange -verify-dom-info -S -pass-remarks=loop-interchange 2>&1 | FileCheck %s @A10 = local_unnamed_addr global [3 x [3 x i32]] zeroinitializer, align 16 -;; Test to make sure we can handle zext intructions introduced by +;; Test to make sure we can handle zext instructions introduced by ;; IndVarSimplify. ;; ;; for (int i = 0; i < 2; ++i) @@ -10,6 +10,8 @@ ;; A[j][i] = i; ;; } +; CHECK: Loop interchanged with enclosing loop. + @A11 = local_unnamed_addr global [3 x [3 x i32]] zeroinitializer, align 16 define void @interchange_11(i32 %n) { @@ -30,9 +32,11 @@ for.body4: ; preds = %for.body4, %for.cond1.preheader %indvars.iv = phi i64 [ 0, %for.cond1.preheader ], [ %indvars.iv.next, %for.body4 ] - %arrayidx6 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* @A10, i64 0, i64 %indvars.iv, i64 %indvars.iv26 - %tmp = trunc i64 %indvars.iv26 to i32 - store i32 %tmp, i32* %arrayidx6, align 4 +; The store below does not appear in the C snippet above. +; With two stores in the loop there may be WAW dependences, and interchange is illegal. +; %arrayidx6 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* @A10, i64 0, i64 %indvars.iv, i64 %indvars.iv26 +; %tmp = trunc i64 %indvars.iv26 to i32 +; store i32 %tmp, i32* %arrayidx6, align 4 %arrayidx10 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* @A10, i64 0, i64 %indvars.iv, i64 %indvars.iv.next27 %tmp1 = trunc i64 %indvars.iv to i32 store i32 %tmp1, i32* %arrayidx10, align 4 @@ -41,40 +45,3 @@ %exitcond = icmp ne i64 %indvars.iv.next, %n.wide br i1 %exitcond, label %for.body4, label %for.cond.loopexit } - -; CHECK-LABEL: @interchange_11 -; CHECK: entry: -; CHECK: br label %for.body4.preheader - -; CHECK: for.cond1.preheader.preheader: -; CHECK: br label %for.cond1.preheader - -; CHECK: for.cond.loopexit: -; CHECK: %exitcond28 = icmp ne i64 %indvars.iv.next27, 2 -; CHECK: br i1 %exitcond28, label %for.cond1.preheader, label %for.body4.split - -; CHECK: for.cond1.preheader: -; CHECK: %indvars.iv26 = phi i64 [ %indvars.iv.next27, %for.cond.loopexit ], [ 0, %for.cond1.preheader.preheader ] -; CHECK: %indvars.iv.next27 = add nuw nsw i64 %indvars.iv26, 1 -; CHECK: br label %for.body4.split1 - -; CHECK: for.body4.preheader: -; CHECK: br label %for.body4 - -; CHECK: for.cond.cleanup: -; CHECK: ret void - -; CHECK: for.body4: -; CHECK: %indvars.iv = phi i64 [ %indvars.iv.next, %for.body4.split ], [ 0, %for.body4.preheader ] -; CHECK: br label %for.cond1.preheader.preheader - -; CHECK: for.body4.split1: -; CHECK: %arrayidx6 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* @A10, i64 0, i64 %indvars.iv, i64 %indvars.iv26 -; CHECK: %tmp = trunc i64 %indvars.iv26 to i32 -; CHECK: store i32 %tmp, i32* %arrayidx6, align 4 -; CHECK: br label %for.cond.loopexit - -; CHECK: for.body4.split: -; CHECK: %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 -; CHECK: %exitcond = icmp ne i64 %indvars.iv.next, %n.wide -; CHECK: br i1 %exitcond, label %for.body4, label %for.cond.cleanup Index: llvm/trunk/test/Transforms/LoopInterchange/interchange-latch-no-exit.ll =================================================================== --- llvm/trunk/test/Transforms/LoopInterchange/interchange-latch-no-exit.ll +++ llvm/trunk/test/Transforms/LoopInterchange/interchange-latch-no-exit.ll @@ -1,40 +0,0 @@ -; RUN: opt < %s -loop-interchange -S | FileCheck %s - -; BB latch1 is the loop latch, but does not exit the loop. -define void @foo() { -entry: - %dest = alloca i16*, align 8 - br label %header1 - -header1: - %0 = phi i16* [ %2, %latch1 ], [ undef, %entry ] - br i1 false, label %inner, label %loopexit - -inner: - br i1 undef, label %inner.ph, label %latch1 - -inner.ph: - br label %inner.body - -inner.body: - %1 = load i16, i16* %0, align 2 - store i16* inttoptr (i64 2 to i16*), i16** %dest, align 8 - br i1 false, label %inner.body, label %inner.loopexit - -inner.loopexit: - br label %latch1 - -latch1: - %2 = phi i16* [ %0, %inner ], [ undef, %inner.loopexit ] - br label %header1 - -loopexit: ; preds = %header1 - unreachable -} - -; CHECK-LABEL: inner.body: -; CHECK: br i1 false, label %inner.body, label %inner.loopexit -; CHECK: latch1: -; CHECK-NEXT: %2 = phi i16* [ %0, %inner ], [ undef, %inner.loopexit ] -; CHECK-NEXT: br label %header1 - Index: llvm/trunk/test/Transforms/LoopInterchange/interchange-no-deps.ll =================================================================== --- llvm/trunk/test/Transforms/LoopInterchange/interchange-no-deps.ll +++ llvm/trunk/test/Transforms/LoopInterchange/interchange-no-deps.ll @@ -1,6 +1,8 @@ -; RUN: opt < %s -loop-interchange -simplifycfg -S | FileCheck %s +; RUN: opt < %s -loop-interchange -simplifycfg -S -pass-remarks=loop-interchange 2>&1 | FileCheck %s +; CHECK: Loop interchanged with enclosing loop. ; no_deps_interchange just access a single nested array and can be interchange. + define i32 @no_deps_interchange([1024 x i32]* nocapture %Arr, i32 %k) local_unnamed_addr #0 { entry: br label %for.body @@ -26,19 +28,3 @@ for.cond.cleanup: ; preds = %for.cond.cleanup3 ret i32 0 } - -; CHECK-LABEL: @no_deps_interchange -; CHECK-LABEL: entry: -; CHECK-NEXT: br label %for.body4 - -; CHECK-LABEL: for.body: ; preds = %for.body4, %for.body -; CHECK: %indvars.iv19 = phi i64 [ %indvars.iv.next20, %for.body ], [ 0, %for.body4 ] -; CHECK: br i1 %exitcond21, label %for.body, label %for.body4.split - -; CHECK-LABEL: for.body4: ; preds = %entry, %for.body4.split -; CHECK: %indvars.iv = phi i64 [ %indvars.iv.next, %for.body4.split ], [ 0, %entry ] -; CHECK: br label %for.body - -; CHECK-LABEL: for.body4.split: ; preds = %for.body -; CHECK: %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 -; CHECK: br i1 %exitcond, label %for.body4, label %for.cond.cleanup Index: llvm/trunk/test/Transforms/LoopInterchange/interchange-not-profitable.ll =================================================================== --- llvm/trunk/test/Transforms/LoopInterchange/interchange-not-profitable.ll +++ llvm/trunk/test/Transforms/LoopInterchange/interchange-not-profitable.ll @@ -1,5 +1,5 @@ -; RUN: opt < %s -basicaa -loop-interchange -S | FileCheck %s -;; We test the complete .ll for adjustment in outer loop header/latch and inner loop header/latch. +; REQUIRES: asserts +; RUN: opt < %s -basicaa -loop-interchange -S -debug 2>&1 | FileCheck %s target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" @@ -12,6 +12,8 @@ ;; for(int j=0;j<100;j++) ;; A[i][j] = A[i][j]+k; +; CHECK: Interchanging loops not profitable. + define void @interchange_03(i32 %k) { entry: br label %for.cond1.preheader @@ -38,29 +40,3 @@ for.end12: ret void } - -; CHECK-LABEL: @interchange_03 -; CHECK: entry: -; CHECK: br label %for.cond1.preheader.preheader -; CHECK: for.cond1.preheader.preheader: ; preds = %entry -; CHECK: br label %for.cond1.preheader -; CHECK: for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.inc10 -; CHECK: %indvars.iv21 = phi i64 [ %indvars.iv.next22, %for.inc10 ], [ 0, %for.cond1.preheader.preheader ] -; CHECK: br label %for.body3.preheader -; CHECK: for.body3.preheader: ; preds = %for.cond1.preheader -; CHECK: br label %for.body3 -; CHECK: for.body3: ; preds = %for.body3.preheader, %for.body3 -; CHECK: %indvars.iv = phi i64 [ %indvars.iv.next, %for.body3 ], [ 0, %for.body3.preheader ] -; CHECK: %arrayidx5 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* @A, i64 0, i64 %indvars.iv21, i64 %indvars.iv -; CHECK: %0 = load i32, i32* %arrayidx5 -; CHECK: %add = add nsw i32 %0, %k -; CHECK: store i32 %add, i32* %arrayidx5 -; CHECK: %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 -; CHECK: %exitcond = icmp eq i64 %indvars.iv.next, 100 -; CHECK: br i1 %exitcond, label %for.inc10, label %for.body3 -; CHECK: for.inc10: ; preds = %for.body3 -; CHECK: %indvars.iv.next22 = add nuw nsw i64 %indvars.iv21, 1 -; CHECK: %exitcond23 = icmp eq i64 %indvars.iv.next22, 100 -; CHECK: br i1 %exitcond23, label %for.end12, label %for.cond1.preheader -; CHECK: for.end12: ; preds = %for.inc10 -; CHECK: ret void Index: llvm/trunk/test/Transforms/LoopInterchange/interchange-output-dependencies.ll =================================================================== --- llvm/trunk/test/Transforms/LoopInterchange/interchange-output-dependencies.ll +++ llvm/trunk/test/Transforms/LoopInterchange/interchange-output-dependencies.ll @@ -1,5 +1,5 @@ -; RUN: opt < %s -basicaa -loop-interchange -verify-dom-info -S | FileCheck %s -;; We test the complete .ll for adjustment in outer loop header/latch and inner loop header/latch. +; REQUIRES: asserts +; RUN: opt < %s -basicaa -loop-interchange -verify-dom-info -S -debug 2>&1 | FileCheck %s target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" @@ -14,6 +14,8 @@ ;; A[j][i+1] = j; ;; } +; CHECK: Not interchanging loops. Cannot prove legality. + @A10 = local_unnamed_addr global [3 x [3 x i32]] zeroinitializer, align 16 define void @interchange_10() { @@ -44,43 +46,3 @@ %exitcond = icmp ne i64 %indvars.iv.next, 3 br i1 %exitcond, label %for.body4, label %for.cond.loopexit } - -; CHECK-LABEL: @interchange_10 -; CHECK: entry: -; CHECK: br label %for.body4.preheader - -; CHECK: for.cond1.preheader.preheader: -; CHECK: br label %for.cond1.preheader - -; CHECK: for.cond.loopexit: -; CHECK: %exitcond28 = icmp ne i64 %indvars.iv.next27, 2 -; CHECK: br i1 %exitcond28, label %for.cond1.preheader, label %for.body4.split - -; CHECK: for.cond1.preheader: -; CHECK: %indvars.iv26 = phi i64 [ %indvars.iv.next27, %for.cond.loopexit ], [ 0, %for.cond1.preheader.preheader ] -; CHECK: %indvars.iv.next27 = add nuw nsw i64 %indvars.iv26, 1 -; CHECK: br label %for.body4.split1 - -; CHECK: for.body4.preheader: -; CHECK: br label %for.body4 - -; CHECK: for.cond.cleanup: -; CHECK: ret void - -; CHECK: for.body4: -; CHECK: %indvars.iv = phi i64 [ %indvars.iv.next, %for.body4.split ], [ 0, %for.body4.preheader ] -; CHECK: br label %for.cond1.preheader.preheader - -; CHECK: for.body4.split1: -; CHECK: %arrayidx6 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* @A10, i64 0, i64 %indvars.iv, i64 %indvars.iv26 -; CHECK: %tmp = trunc i64 %indvars.iv26 to i32 -; CHECK: store i32 %tmp, i32* %arrayidx6, align 4 -; CHECK: %arrayidx10 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* @A10, i64 0, i64 %indvars.iv, i64 %indvars.iv.next27 -; CHECK: %tmp1 = trunc i64 %indvars.iv to i32 -; CHECK: store i32 %tmp1, i32* %arrayidx10, align 4 -; CHECK: br label %for.cond.loopexit - -; CHECK: for.body4.split: -; CHECK: %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 -; CHECK: %exitcond = icmp ne i64 %indvars.iv.next, 3 -; CHECK: br i1 %exitcond, label %for.body4, label %for.cond.cleanup Index: llvm/trunk/test/Transforms/LoopInterchange/interchange-simple-count-down.ll =================================================================== --- llvm/trunk/test/Transforms/LoopInterchange/interchange-simple-count-down.ll +++ llvm/trunk/test/Transforms/LoopInterchange/interchange-simple-count-down.ll @@ -1,5 +1,4 @@ -; RUN: opt < %s -basicaa -loop-interchange -verify-dom-info -S | FileCheck %s -;; We test the complete .ll for adjustment in outer loop header/latch and inner loop header/latch. +; RUN: opt < %s -basicaa -loop-interchange -verify-dom-info -S -pass-remarks=loop-interchange 2>&1 | FileCheck %s target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" @@ -11,6 +10,8 @@ ;; for(int j=100;j>=0;j--) ;; A[j][i] = A[j][i]+k; +; CHECK: Loop interchanged with enclosing loop. + define void @interchange_02(i32 %k) { entry: br label %for.cond1.preheader @@ -37,33 +38,3 @@ for.end11: ret void } - -; CHECK-LABEL: @interchange_02 -; CHECK: entry: -; CHECK: br label %for.body3.preheader -; CHECK: for.cond1.preheader.preheader: -; CHECK: br label %for.cond1.preheader -; CHECK: for.cond1.preheader: -; CHECK: %indvars.iv19 = phi i64 [ %indvars.iv.next20, %for.inc10 ], [ 0, %for.cond1.preheader.preheader ] -; CHECK: br label %for.body3.split1 -; CHECK: for.body3.preheader: -; CHECK: br label %for.body3 -; CHECK: for.body3: -; CHECK: %indvars.iv = phi i64 [ %indvars.iv.next, %for.body3.split ], [ 100, %for.body3.preheader ] -; CHECK: br label %for.cond1.preheader.preheader -; CHECK: for.body3.split1: ; preds = %for.cond1.preheader -; CHECK: %arrayidx5 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* @A, i64 0, i64 %indvars.iv, i64 %indvars.iv19 -; CHECK: %0 = load i32, i32* %arrayidx5 -; CHECK: %add = add nsw i32 %0, %k -; CHECK: store i32 %add, i32* %arrayidx5 -; CHECK: br label %for.inc10 -; CHECK: for.body3.split: -; CHECK: %indvars.iv.next = add nsw i64 %indvars.iv, -1 -; CHECK: %cmp2 = icmp sgt i64 %indvars.iv, 0 -; CHECK: br i1 %cmp2, label %for.body3, label %for.end11 -; CHECK: for.inc10: -; CHECK: %indvars.iv.next20 = add nuw nsw i64 %indvars.iv19, 1 -; CHECK: %exitcond = icmp eq i64 %indvars.iv.next20, 100 -; CHECK: br i1 %exitcond, label %for.body3.split, label %for.cond1.preheader -; CHECK: for.end11: -; CHECK: ret void Index: llvm/trunk/test/Transforms/LoopInterchange/interchange-simple-count-up.ll =================================================================== --- llvm/trunk/test/Transforms/LoopInterchange/interchange-simple-count-up.ll +++ llvm/trunk/test/Transforms/LoopInterchange/interchange-simple-count-up.ll @@ -1,5 +1,5 @@ -; RUN: opt < %s -basicaa -loop-interchange -verify-dom-info -S | FileCheck %s -;; We test the complete .ll for adjustment in outer loop header/latch and inner loop header/latch. +; REQUIRES: asserts +; RUN: opt < %s -basicaa -loop-interchange -verify-dom-info -S -debug 2>&1 | FileCheck %s target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" @@ -11,6 +11,8 @@ ;; for(int j=1;j&1 | FileCheck %s target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" @@ -12,6 +12,8 @@ ;; for(int i=0;i<99;i++) ;; A[j][i+1] = A[j+1][i]+k; +; CHECK: Not interchanging loops. Cannot prove legality. + define void @interchange_04(i32 %k){ entry: br label %for.cond1.preheader @@ -39,26 +41,3 @@ for.end14: ret void } - -; CHECK-LABEL: @interchange_04 -; CHECK: entry: -; CHECK: br label %for.cond1.preheader -; CHECK: for.cond1.preheader: ; preds = %for.inc12, %entry -; CHECK: %indvars.iv23 = phi i64 [ 0, %entry ], [ %indvars.iv.next24, %for.inc12 ] -; CHECK: %indvars.iv.next24 = add nuw nsw i64 %indvars.iv23, 1 -; CHECK: br label %for.body3 -; CHECK: for.body3: ; preds = %for.body3, %for.cond1.preheader -; CHECK: %indvars.iv = phi i64 [ 0, %for.cond1.preheader ], [ %indvars.iv.next, %for.body3 ] -; CHECK: %arrayidx5 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* @A, i64 0, i64 %indvars.iv.next24, i64 %indvars.iv -; CHECK: %0 = load i32, i32* %arrayidx5 -; CHECK: %add6 = add nsw i32 %0, %k -; CHECK: %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 -; CHECK: %arrayidx11 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* @A, i64 0, i64 %indvars.iv23, i64 %indvars.iv.next -; CHECK: store i32 %add6, i32* %arrayidx11 -; CHECK: %exitcond = icmp eq i64 %indvars.iv.next, 99 -; CHECK: br i1 %exitcond, label %for.inc12, label %for.body3 -; CHECK: for.inc12: ; preds = %for.body3 -; CHECK: %exitcond25 = icmp eq i64 %indvars.iv.next24, 99 -; CHECK: br i1 %exitcond25, label %for.end14, label %for.cond1.preheader -; CHECK: for.end14: ; preds = %for.inc12 -; CHECK: ret void Index: llvm/trunk/test/Transforms/LoopInterchange/not-interchanged-loop-nest-3.ll =================================================================== --- llvm/trunk/test/Transforms/LoopInterchange/not-interchanged-loop-nest-3.ll +++ llvm/trunk/test/Transforms/LoopInterchange/not-interchanged-loop-nest-3.ll @@ -1,5 +1,5 @@ -; RUN: opt < %s -basicaa -loop-interchange -S | FileCheck %s -;; We test the complete .ll for adjustment in outer loop header/latch and inner loop header/latch. +; REQUIRES: asserts +; RUN: opt < %s -basicaa -loop-interchange -S -debug 2>&1 | FileCheck %s target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" @@ -12,6 +12,12 @@ ;; for(int k=0;k<100;k++) ;; D[i][k][j] = D[i][k][j]+t; +; CHECK: Processing Inner Loop Id = 2 and OuterLoopId = 1 +; CHECK: Loops interchanged. + +; CHECK: Processing Inner Loop Id = 1 and OuterLoopId = 0 +; CHECK: Interchanging loops not profitable. + define void @interchange_08(i32 %t){ entry: br label %for.cond1.preheader @@ -47,41 +53,3 @@ for.end17: ; preds = %for.inc15 ret void } -; CHECK-LABEL: @interchange_08 -; CHECK: entry: -; CHECK: br label %for.cond1.preheader.preheader -; CHECK: for.cond1.preheader.preheader: ; preds = %entry -; CHECK: br label %for.cond1.preheader -; CHECK: for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.inc15 -; CHECK: %i.028 = phi i32 [ %inc16, %for.inc15 ], [ 0, %for.cond1.preheader.preheader ] -; CHECK: br label %for.body6.preheader -; CHECK: for.cond4.preheader.preheader: ; preds = %for.body6 -; CHECK: br label %for.cond4.preheader -; CHECK: for.cond4.preheader: ; preds = %for.cond4.preheader.preheader, %for.inc12 -; CHECK: %j.027 = phi i32 [ %inc13, %for.inc12 ], [ 0, %for.cond4.preheader.preheader ] -; CHECK: br label %for.body6.split1 -; CHECK: for.body6.preheader: ; preds = %for.cond1.preheader -; CHECK: br label %for.body6 -; CHECK: for.body6: ; preds = %for.body6.preheader, %for.body6.split -; CHECK: %k.026 = phi i32 [ %inc, %for.body6.split ], [ 0, %for.body6.preheader ] -; CHECK: br label %for.cond4.preheader.preheader -; CHECK: for.body6.split1: ; preds = %for.cond4.preheader -; CHECK: %arrayidx8 = getelementptr inbounds [100 x [100 x [100 x i32]]], [100 x [100 x [100 x i32]]]* @D, i32 0, i32 %i.028, i32 %k.026, i32 %j.027 -; CHECK: %0 = load i32, i32* %arrayidx8 -; CHECK: %add = add nsw i32 %0, %t -; CHECK: store i32 %add, i32* %arrayidx8 -; CHECK: br label %for.inc12 -; CHECK: for.body6.split: ; preds = %for.inc12 -; CHECK: %inc = add nuw nsw i32 %k.026, 1 -; CHECK: %exitcond = icmp eq i32 %inc, 100 -; CHECK: br i1 %exitcond, label %for.inc15, label %for.body6 -; CHECK: for.inc12: ; preds = %for.body6.split1 -; CHECK: %inc13 = add nuw nsw i32 %j.027, 1 -; CHECK: %exitcond29 = icmp eq i32 %inc13, 100 -; CHECK: br i1 %exitcond29, label %for.body6.split, label %for.cond4.preheader -; CHECK: for.inc15: ; preds = %for.body6.split -; CHECK: %inc16 = add nuw nsw i32 %i.028, 1 -; CHECK: %exitcond30 = icmp eq i32 %inc16, 100 -; CHECK: br i1 %exitcond30, label %for.end17, label %for.cond1.preheader -; CHECK: for.end17: ; preds = %for.inc15 -; CHECK: ret void Index: llvm/trunk/test/Transforms/LoopInterchange/not-interchanged-tightly-nested.ll =================================================================== --- llvm/trunk/test/Transforms/LoopInterchange/not-interchanged-tightly-nested.ll +++ llvm/trunk/test/Transforms/LoopInterchange/not-interchanged-tightly-nested.ll @@ -1,5 +1,5 @@ -; RUN: opt < %s -basicaa -loop-interchange -S | FileCheck %s -;; We test the complete .ll for adjustment in outer loop header/latch and inner loop header/latch. +; REQUIRES: asserts +; RUN: opt < %s -basicaa -loop-interchange -S -debug 2>&1 | FileCheck %s target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" @@ -16,6 +16,8 @@ ;; A[j][i] = A[j][i]+B[j]; ;; } +; CHECK: Not interchanging loops. Cannot prove legality. + define void @interchange_05(i32 %k, i32 %N){ entry: %cmp30 = icmp sgt i32 %N, 0 @@ -55,44 +57,6 @@ ret void } -; CHECK-LABEL: @interchange_05 -; CHECK: entry: -; CHECK: %cmp30 = icmp sgt i32 %N, 0 -; CHECK: br i1 %cmp30, label %for.body.lr.ph, label %for.end17 -; CHECK: for.body.lr.ph: -; CHECK: %0 = add i32 %N, -1 -; CHECK: %1 = zext i32 %k to i64 -; CHECK: br label %for.body -; CHECK: for.body: -; CHECK: %indvars.iv32 = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next33, %for.inc15 ] -; CHECK: %2 = add nsw i64 %indvars.iv32, %1 -; CHECK: %arrayidx = getelementptr inbounds [100 x i32], [100 x i32]* @B, i64 0, i64 %indvars.iv32 -; CHECK: %3 = trunc i64 %2 to i32 -; CHECK: store i32 %3, i32* %arrayidx -; CHECK: br label %for.body3.preheader -; CHECK: for.body3.preheader: -; CHECK: br label %for.body3 -; CHECK: for.body3: -; CHECK: %indvars.iv = phi i64 [ %indvars.iv.next, %for.body3 ], [ 0, %for.body3.preheader ] -; CHECK: %arrayidx7 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* @A, i64 0, i64 %indvars.iv32, i64 %indvars.iv -; CHECK: %4 = load i32, i32* %arrayidx7 -; CHECK: %add10 = add nsw i32 %3, %4 -; CHECK: store i32 %add10, i32* %arrayidx7 -; CHECK: %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 -; CHECK: %lftr.wideiv = trunc i64 %indvars.iv to i32 -; CHECK: %exitcond = icmp eq i32 %lftr.wideiv, %0 -; CHECK: br i1 %exitcond, label %for.inc15, label %for.body3 -; CHECK: for.inc15: -; CHECK: %indvars.iv.next33 = add nuw nsw i64 %indvars.iv32, 1 -; CHECK: %lftr.wideiv35 = trunc i64 %indvars.iv32 to i32 -; CHECK: %exitcond36 = icmp eq i32 %lftr.wideiv35, %0 -; CHECK: br i1 %exitcond36, label %for.end17.loopexit, label %for.body -; CHECK: for.end17.loopexit: -; CHECK: br label %for.end17 -; CHECK: for.end17: -; CHECK: ret void - - declare void @foo(...) readnone ;; Loops not tightly nested are not interchanged @@ -102,6 +66,8 @@ ;; A[j][i] = A[j][i]+k; ;; } +; CHECK: Not interchanging loops. Cannot prove legality. + define void @interchange_06(i32 %k, i32 %N) { entry: %cmp22 = icmp sgt i32 %N, 0 @@ -136,8 +102,3 @@ for.end12: ret void } -;; Here we are checking if the inner phi is not split then we have not interchanged. -; CHECK-LABEL: @interchange_06 -; CHECK: phi i64 [ %indvars.iv.next, %for.body3 ], [ 2, %for.body3.preheader ] -; CHECK-NEXT: getelementptr -; CHECK-NEXT: %1 = load Index: llvm/trunk/test/Transforms/LoopInterchange/phi-ordering.ll =================================================================== --- llvm/trunk/test/Transforms/LoopInterchange/phi-ordering.ll +++ llvm/trunk/test/Transforms/LoopInterchange/phi-ordering.ll @@ -1,7 +1,10 @@ -; RUN: opt < %s -loop-interchange -verify-dom-info -S | FileCheck %s +; REQUIRES: asserts +; RUN: opt < %s -loop-interchange -verify-dom-info -S -debug 2>&1 | FileCheck %s ;; Checks the order of the inner phi nodes does not cause havoc. ;; The inner loop has a reduction into c. The IV is not the first phi. +; CHECK: Not interchanging loops. Cannot prove legality. + target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" target triple = "armv8--linux-gnueabihf" @@ -61,30 +64,3 @@ for.end21: ; preds = %for.end21.loopexit, %entry ret void } - - -; CHECK-LABEL: test -; CHECK: entry: -; CHECK: br i1 %cmp45, label %for.body6.preheader, label %for.end21 -; CHECK: for.body3.lr.ph.preheader: -; CHECK: br label %for.body3.lr.ph -; CHECK: for.body3.lr.ph: -; CHECK: br label %for.body6.lr.ph.preheader -; CHECK: for.body6.lr.ph.preheader: -; CHECK: br label %for.body6.lr.ph -; CHECK: for.body6.lr.ph: -; CHECK: br label %for.body6.split1 -; CHECK: for.body6.preheader: -; CHECK: br label %for.body6 -; CHECK: for.body6: -; CHECK: br label %for.body3.lr.ph.preheader -; CHECK: for.body6.split1: -; CHECK: br label %for.inc16 -; CHECK: for.body6.split: -; CHECK: add nuw nsw i32 %k.040, 1 -; CHECK: br i1 %exitcond, label %for.end21.loopexit, label %for.body6 -; CHECK: for.inc16: -; CHECK: br i1 %exitcond47, label %for.inc19, label %for.body6.lr.ph -; CHECK: for.inc19: -; CHECK: br i1 %exitcond48, label %for.body6.split, label %for.body3.lr.ph -; CHECK: for.end21: Index: llvm/trunk/test/Transforms/LoopInterchange/profitability.ll =================================================================== --- llvm/trunk/test/Transforms/LoopInterchange/profitability.ll +++ llvm/trunk/test/Transforms/LoopInterchange/profitability.ll @@ -1,4 +1,5 @@ -; RUN: opt < %s -basicaa -loop-interchange -verify-dom-info -S | FileCheck %s +; REQUIRES: asserts +; RUN: opt < %s -basicaa -loop-interchange -verify-dom-info -S -debug 2>&1 | FileCheck %s ;; We test profitability model in these test cases. target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" @@ -13,6 +14,8 @@ ;; for(int j=1;j&1 | FileCheck %s @A = common global [500 x [500 x i32]] zeroinitializer @X = common global i32 0 @@ -9,6 +10,9 @@ ;; for( int j=1;j