From 2d0ece960fb4d60f74eb9a97858da97a659aa2f8 Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Thu, 24 Sep 2015 11:41:21 +0000 Subject: [PATCH] Remove Analysis Output of TempScopInfo After the merge of TempScopInfo into ScopInfo the analysis output remained because of the existing unit tests. These remains are removed and the units tests converted to match the equivalent output of ScopInfo's analysis output. The unit tests are also moved into the directory of ScopInfo tests. Differential Revision: http://reviews.llvm.org/D13116 llvm-svn: 248485 --- polly/include/polly/ScopInfo.h | 51 +++-------- polly/lib/Analysis/ScopInfo.cpp | 91 +++++-------------- polly/test/ScopInfo/cond_in_loop.ll | 3 +- .../inter_bb_scalar_dep.ll | 15 ++- .../intra_and_inter_bb_scalar_dep.ll | 19 ++-- .../intra_bb_scalar_dep.ll | 8 +- .../{TempScop => ScopInfo}/nested-loops.ll | 0 .../{TempScop => ScopInfo}/not-a-reduction.ll | 0 .../{TempScop => ScopInfo}/scalar_to_array.ll | 48 ++++++---- .../tempscop-printing.ll | 36 +++++--- 10 files changed, 118 insertions(+), 153 deletions(-) rename polly/test/{TempScop => ScopInfo}/inter_bb_scalar_dep.ll (71%) rename polly/test/{TempScop => ScopInfo}/intra_and_inter_bb_scalar_dep.ll (67%) rename polly/test/{TempScop => ScopInfo}/intra_bb_scalar_dep.ll (83%) rename polly/test/{TempScop => ScopInfo}/nested-loops.ll (100%) rename polly/test/{TempScop => ScopInfo}/not-a-reduction.ll (100%) rename polly/test/{TempScop => ScopInfo}/scalar_to_array.ll (78%) rename polly/test/{TempScop => ScopInfo}/tempscop-printing.ll (58%) diff --git a/polly/include/polly/ScopInfo.h b/polly/include/polly/ScopInfo.h index 47aa62114f8c..1dc059853ae0 100644 --- a/polly/include/polly/ScopInfo.h +++ b/polly/include/polly/ScopInfo.h @@ -333,11 +333,6 @@ private: /// Value *AccessValue; - /// @brief Accessed element relative to the base pointer (in bytes). - /// - /// Currently only used by printIR. - const SCEV *Offset; - /// @brief Are all the subscripts affine expression? bool IsAffine; @@ -358,8 +353,6 @@ private: /// @brief Is this MemoryAccess modeling special PHI node accesses? bool isPHI() const { return IsPHI; } - void printIR(raw_ostream &OS) const; - void setStatement(ScopStmt *Stmt) { this->Statement = Stmt; } __isl_give isl_basic_map *createBasicAccessMap(ScopStmt *Statement); @@ -426,7 +419,6 @@ public: /// @param Id Identifier that is guranteed to be unique within the /// same ScopStmt. /// @param BaseAddr The accessed array's address. - /// @param Offset Accessed memoray location relative to @p BaseAddr. /// @param ElemBytes Number of accessed bytes. /// @param AccType Whether read or write access. /// @param IsAffine Whether the subscripts are affine expressions. @@ -435,10 +427,9 @@ public: /// @param Sizes Dimension lengths of the accessed array. /// @param BaseName Name of the acessed array. MemoryAccess(Instruction *AccessInst, __isl_take isl_id *Id, AccessType Type, - Value *BaseAddress, const SCEV *Offset, unsigned ElemBytes, - bool Affine, ArrayRef Subscripts, - ArrayRef Sizes, Value *AccessValue, bool IsPHI, - StringRef BaseName); + Value *BaseAddress, unsigned ElemBytes, bool Affine, + ArrayRef Subscripts, ArrayRef Sizes, + Value *AccessValue, bool IsPHI, StringRef BaseName); ~MemoryAccess(); /// @brief Get the type of a memory access. @@ -1120,22 +1111,6 @@ public: } //@} - /// @brief Print data access information. - /// - /// @param OS The output stream the access functions is printed to. - /// @param SE The ScalarEvolution to help printing more details. - /// @param LI The LoopInfo that help printing the access functions. - void printIRAccesses(raw_ostream &OS, ScalarEvolution *SE, - LoopInfo *LI) const; - - /// @brief Print the access functions and loop bounds in this Scop. - /// - /// @param OS The output stream the access functions is printed to. - /// @param SE The ScalarEvolution that help printing the access functions. - /// @param LI The LoopInfo that help printing the access functions. - void printIRAccessesDetail(raw_ostream &OS, ScalarEvolution *SE, LoopInfo *LI, - const Region *Reg, unsigned ind) const; - ScalarEvolution *getSE() const; /// @brief Get the count of parameters used in this Scop. @@ -1503,7 +1478,6 @@ class ScopInfo : public RegionPass { /// inside @p BB. /// @param Type The kind of access. /// @param BaseAddress The accessed array's base address. - /// @param Offset Accessed location relative to @p BaseAddress. /// @param ElemBytes Size of accessed array element. /// @param Affine Whether all subscripts are affine expressions. /// @param AccessValue Value read or written. @@ -1512,26 +1486,25 @@ class ScopInfo : public RegionPass { /// @param IsPHI Whether this is an emulated PHI node. void addMemoryAccess(BasicBlock *BB, Instruction *Inst, MemoryAccess::AccessType Type, Value *BaseAddress, - const SCEV *Offset, unsigned ElemBytes, bool Affine, - Value *AccessValue, ArrayRef Subscripts, + unsigned ElemBytes, bool Affine, Value *AccessValue, + ArrayRef Subscripts, ArrayRef Sizes, bool IsPHI); void addMemoryAccess(BasicBlock *BB, Instruction *Inst, MemoryAccess::AccessType Type, Value *BaseAddress, - const SCEV *Offset, unsigned ElemBytes, bool Affine, - Value *AccessValue, bool IsPHI = false) { - addMemoryAccess(BB, Inst, Type, BaseAddress, Offset, ElemBytes, Affine, - AccessValue, ArrayRef(), - ArrayRef(), IsPHI); + unsigned ElemBytes, bool Affine, Value *AccessValue, + bool IsPHI = false) { + addMemoryAccess(BB, Inst, Type, BaseAddress, ElemBytes, Affine, AccessValue, + ArrayRef(), ArrayRef(), IsPHI); } void addMemoryAccess(BasicBlock *BB, Instruction *Inst, MemoryAccess::AccessType Type, Value *BaseAddress, - const SCEV *Offset, unsigned ElemBytes, bool Affine, + unsigned ElemBytes, bool Affine, ArrayRef Subscripts, ArrayRef Sizes, Value *AccessValue) { - addMemoryAccess(BB, Inst, Type, BaseAddress, Offset, ElemBytes, Affine, - AccessValue, Subscripts, Sizes, false); + addMemoryAccess(BB, Inst, Type, BaseAddress, ElemBytes, Affine, AccessValue, + Subscripts, Sizes, false); } public: diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp index efa42600e7ed..d3fcdcba911c 100644 --- a/polly/lib/Analysis/ScopInfo.cpp +++ b/polly/lib/Analysis/ScopInfo.cpp @@ -227,17 +227,6 @@ const ScopArrayInfo *ScopArrayInfo::getFromId(isl_id *Id) { return SAI; } -void MemoryAccess::printIR(raw_ostream &OS) const { - if (isRead()) - OS << "Read "; - else { - if (isMayWrite()) - OS << "May"; - OS << "Write "; - } - OS << BaseAddr->getName() << '[' << *Offset << "]\n"; -} - const std::string MemoryAccess::getReductionOperatorStr(MemoryAccess::ReductionType RT) { switch (RT) { @@ -614,14 +603,14 @@ void MemoryAccess::buildAccessRelation(const ScopArrayInfo *SAI) { MemoryAccess::MemoryAccess(Instruction *AccessInst, __isl_take isl_id *Id, AccessType Type, Value *BaseAddress, - const SCEV *Offset, unsigned ElemBytes, bool Affine, + unsigned ElemBytes, bool Affine, ArrayRef Subscripts, ArrayRef Sizes, Value *AccessValue, bool IsPHI, StringRef BaseName) : Id(Id), IsPHI(IsPHI), AccType(Type), RedType(RT_NONE), Statement(nullptr), BaseAddr(BaseAddress), BaseName(BaseName), ElemBytes(ElemBytes), Sizes(Sizes.begin(), Sizes.end()), AccessInstruction(AccessInst), - AccessValue(AccessValue), Offset(Offset), IsAffine(Affine), + AccessValue(AccessValue), IsAffine(Affine), Subscripts(Subscripts.begin(), Subscripts.end()), AccessRelation(nullptr), NewAccessRelation(nullptr) {} @@ -2668,34 +2657,6 @@ ScopStmt *Scop::getStmtForBasicBlock(BasicBlock *BB) const { return StmtMapIt->second; } -void Scop::printIRAccesses(raw_ostream &OS, ScalarEvolution *SE, - LoopInfo *LI) const { - OS << "Scop: " << R.getNameStr() << "\n"; - - printIRAccessesDetail(OS, SE, LI, &R, 0); -} - -void Scop::printIRAccessesDetail(raw_ostream &OS, ScalarEvolution *SE, - LoopInfo *LI, const Region *CurR, - unsigned ind) const { - // FIXME: Print other details rather than memory accesses. - for (const auto &CurBlock : CurR->blocks()) { - AccFuncMapType::const_iterator AccSetIt = AccFuncMap.find(CurBlock); - - // Ignore trivial blocks that do not contain any memory access. - if (AccSetIt == AccFuncMap.end()) - continue; - - OS.indent(ind) << "BB: " << CurBlock->getName() << '\n'; - typedef AccFuncSetType::const_iterator access_iterator; - const AccFuncSetType &AccFuncs = AccSetIt->second; - - for (access_iterator AI = AccFuncs.begin(), AE = AccFuncs.end(); AI != AE; - ++AI) - AI->printIR(OS.indent(ind + 2)); - } -} - int Scop::getRelativeLoopDepth(const Loop *L) const { Loop *OuterLoop = L ? R.outermostLoopInRegion(const_cast(L)) : nullptr; @@ -2742,10 +2703,9 @@ void ScopInfo::buildPHIAccesses(PHINode *PHI, Region &R, // we have to insert a scalar dependence from the definition of OpI to // OpBB if the definition is not in OpBB. if (OpIBB != OpBB) { - addMemoryAccess(OpBB, PHI, MemoryAccess::READ, OpI, ZeroOffset, 1, true, + addMemoryAccess(OpBB, PHI, MemoryAccess::READ, OpI, 1, true, OpI); + addMemoryAccess(OpIBB, OpI, MemoryAccess::MUST_WRITE, OpI, 1, true, OpI); - addMemoryAccess(OpIBB, OpI, MemoryAccess::MUST_WRITE, OpI, ZeroOffset, - 1, true, OpI); } } @@ -2753,13 +2713,13 @@ void ScopInfo::buildPHIAccesses(PHINode *PHI, Region &R, // instruction. OpI = OpBB->getTerminator(); - addMemoryAccess(OpBB, OpI, MemoryAccess::MUST_WRITE, PHI, ZeroOffset, 1, - true, Op, /* IsPHI */ !IsExitBlock); + addMemoryAccess(OpBB, OpI, MemoryAccess::MUST_WRITE, PHI, 1, true, Op, + /* IsPHI */ !IsExitBlock); } if (!OnlyNonAffineSubRegionOperands) { - addMemoryAccess(PHI->getParent(), PHI, MemoryAccess::READ, PHI, ZeroOffset, - 1, true, PHI, + addMemoryAccess(PHI->getParent(), PHI, MemoryAccess::READ, PHI, 1, true, + PHI, /* IsPHI */ !IsExitBlock); } } @@ -2816,8 +2776,7 @@ bool ScopInfo::buildScalarDependences(Instruction *Inst, Region *R, // Do not build a read access that is not in the current SCoP // Use the def instruction as base address of the MemoryAccess, so that it // will become the name of the scalar access in the polyhedral form. - addMemoryAccess(UseParent, UI, MemoryAccess::READ, Inst, ZeroOffset, 1, - true, Inst); + addMemoryAccess(UseParent, UI, MemoryAccess::READ, Inst, 1, true, Inst); } if (ModelReadOnlyScalars) { @@ -2832,8 +2791,8 @@ bool ScopInfo::buildScalarDependences(Instruction *Inst, Region *R, if (isa(Op)) continue; - addMemoryAccess(Inst->getParent(), Inst, MemoryAccess::READ, Op, - ZeroOffset, 1, true, Op); + addMemoryAccess(Inst->getParent(), Inst, MemoryAccess::READ, Op, 1, true, + Op); } } @@ -2905,7 +2864,7 @@ void ScopInfo::buildMemoryAccess( IntegerType::getInt64Ty(BasePtr->getContext()), Size))); addMemoryAccess(Inst->getParent(), Inst, Type, BasePointer->getValue(), - AccessFunction, Size, true, Subscripts, SizesSCEV, Val); + Size, true, Subscripts, SizesSCEV, Val); return; } } @@ -2914,8 +2873,7 @@ void ScopInfo::buildMemoryAccess( auto AccItr = InsnToMemAcc.find(Inst); if (PollyDelinearize && AccItr != InsnToMemAcc.end()) { addMemoryAccess(Inst->getParent(), Inst, Type, BasePointer->getValue(), - AccessFunction, Size, true, - AccItr->second.DelinearizedSubscripts, + Size, true, AccItr->second.DelinearizedSubscripts, AccItr->second.Shape->DelinearizedSizes, Val); return; } @@ -2940,8 +2898,8 @@ void ScopInfo::buildMemoryAccess( if (!IsAffine && Type == MemoryAccess::MUST_WRITE) Type = MemoryAccess::MAY_WRITE; - addMemoryAccess(Inst->getParent(), Inst, Type, BasePointer->getValue(), - AccessFunction, Size, IsAffine, Subscripts, Sizes, Val); + addMemoryAccess(Inst->getParent(), Inst, Type, BasePointer->getValue(), Size, + IsAffine, Subscripts, Sizes, Val); } void ScopInfo::buildAccessFunctions(Region &R, Region &SR) { @@ -2986,17 +2944,19 @@ void ScopInfo::buildAccessFunctions(Region &R, BasicBlock &BB, if (buildScalarDependences(Inst, &R, NonAffineSubRegion)) { if (!isa(Inst)) - addMemoryAccess(&BB, Inst, MemoryAccess::MUST_WRITE, Inst, ZeroOffset, - 1, true, Inst); + addMemoryAccess(&BB, Inst, MemoryAccess::MUST_WRITE, Inst, 1, true, + Inst); } } } -void ScopInfo::addMemoryAccess( - BasicBlock *BB, Instruction *Inst, MemoryAccess::AccessType Type, - Value *BaseAddress, const SCEV *Offset, unsigned ElemBytes, bool Affine, - Value *AccessValue, ArrayRef Subscripts, - ArrayRef Sizes, bool IsPHI = false) { +void ScopInfo::addMemoryAccess(BasicBlock *BB, Instruction *Inst, + MemoryAccess::AccessType Type, + Value *BaseAddress, unsigned ElemBytes, + bool Affine, Value *AccessValue, + ArrayRef Subscripts, + ArrayRef Sizes, + bool IsPHI = false) { AccFuncSetType &AccList = AccFuncMap[BB]; size_t Identifier = AccList.size(); @@ -3006,7 +2966,7 @@ void ScopInfo::addMemoryAccess( std::string IdName = "__polly_array_ref_" + std::to_string(Identifier); isl_id *Id = isl_id_alloc(ctx, IdName.c_str(), nullptr); - AccList.emplace_back(Inst, Id, Type, BaseAddress, Offset, ElemBytes, Affine, + AccList.emplace_back(Inst, Id, Type, BaseAddress, ElemBytes, Affine, Subscripts, Sizes, AccessValue, IsPHI, BaseName); } @@ -3036,7 +2996,6 @@ void ScopInfo::print(raw_ostream &OS, const Module *) const { return; } - scop->printIRAccesses(OS, SE, LI); scop->print(OS); } diff --git a/polly/test/ScopInfo/cond_in_loop.ll b/polly/test/ScopInfo/cond_in_loop.ll index 47d4d017657c..c5898a305de0 100644 --- a/polly/test/ScopInfo/cond_in_loop.ll +++ b/polly/test/ScopInfo/cond_in_loop.ll @@ -45,4 +45,5 @@ return: ; preds = %bb3, %entry } ; CHECK-LABEL: Printing analysis 'Polly - Create polyhedral description of Scops' for region: 'bb => return' in function 'f': -; CHECK-NEXT: Scop: bb => return +; CHECK-NEXT: Function: f +; CHECK-NEXT: Region: %bb---%return diff --git a/polly/test/TempScop/inter_bb_scalar_dep.ll b/polly/test/ScopInfo/inter_bb_scalar_dep.ll similarity index 71% rename from polly/test/TempScop/inter_bb_scalar_dep.ll rename to polly/test/ScopInfo/inter_bb_scalar_dep.ll index cc684fba8417..f8d91fba5c47 100644 --- a/polly/test/TempScop/inter_bb_scalar_dep.ll +++ b/polly/test/ScopInfo/inter_bb_scalar_dep.ll @@ -25,16 +25,21 @@ for.i: ; preds = %for.i.end, %entry entry.next: ; preds = %for.i %init = load i64, i64* %init_ptr -; CHECK: BB: entry.next -; CHECK: Read init_ptr[0] -; CHECK: Write init[0] +; CHECK-LABEL: Stmt_entry_next +; CHECK: ReadAccess := [Reduction Type: NONE] [Scalar: 0] +; CHECK-NEXT: [N] -> { Stmt_entry_next[i0] -> MemRef_init_ptr[0] }; +; CHECK: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1] +; CHECK-NEXT: [N] -> { Stmt_entry_next[i0] -> MemRef_init[] }; br label %for.j for.j: ; preds = %for.j, %entry.next %indvar.j = phi i64 [ 0, %entry.next ], [ %indvar.j.next, %for.j ] %init_plus_two = add i64 %init, 2 -; CHECK: Read init[0] -; CHECK: Write A[{0,+,8}<%for.j>] +; CHECK-LABEL: Stmt_for_j +; CHECK: ReadAccess := [Reduction Type: NONE] [Scalar: 1] +; CHECK-NEXT: [N] -> { Stmt_for_j[i0, i1] -> MemRef_init[] }; +; CHECK: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0] +; CHECK-NEXT: [N] -> { Stmt_for_j[i0, i1] -> MemRef_A[i1] }; %scevgep = getelementptr i64, i64* %A, i64 %indvar.j store i64 %init_plus_two, i64* %scevgep %indvar.j.next = add nsw i64 %indvar.j, 1 diff --git a/polly/test/TempScop/intra_and_inter_bb_scalar_dep.ll b/polly/test/ScopInfo/intra_and_inter_bb_scalar_dep.ll similarity index 67% rename from polly/test/TempScop/intra_and_inter_bb_scalar_dep.ll rename to polly/test/ScopInfo/intra_and_inter_bb_scalar_dep.ll index c459f8cc7eb4..3766e17d136d 100644 --- a/polly/test/TempScop/intra_and_inter_bb_scalar_dep.ll +++ b/polly/test/ScopInfo/intra_and_inter_bb_scalar_dep.ll @@ -26,19 +26,24 @@ for.i: ; preds = %for.i.end, %entry entry.next: ; preds = %for.i %init = load i64, i64* %init_ptr -; CHECK: BB: entry.next -; CHECK: Read init_ptr[0] -; CHECK: Write init[0] +; CHECK-LABEL: Stmt_entry_next +; CHECK: ReadAccess := [Reduction Type: NONE] [Scalar: 0] +; CHECK-NEXT: [N] -> { Stmt_entry_next[i0] -> MemRef_init_ptr[0] }; +; CHECK: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1] +; CHECK-NEXT: [N] -> { Stmt_entry_next[i0] -> MemRef_init[] }; br label %for.j for.j: ; preds = %for.j, %entry.next %indvar.j = phi i64 [ 0, %entry.next ], [ %indvar.j.next, %for.j ] %init_2 = load i64, i64* %init_ptr %init_sum = add i64 %init, %init_2 -; CHECK: BB: for.j -; CHECK: Read init[0] -; CHECK: Read init_ptr[0] -; CHECK: Write A[{0,+,8}<%for.j>] +; CHECK-LABEL: Stmt_for_j +; CHECK: ReadAccess := [Reduction Type: NONE] [Scalar: 1] +; CHECK-NEXT: [N] -> { Stmt_for_j[i0, i1] -> MemRef_init[] }; +; CHECK: ReadAccess := [Reduction Type: NONE] [Scalar: 0] +; CHECK-NEXT: [N] -> { Stmt_for_j[i0, i1] -> MemRef_init_ptr[0] }; +; CHECK: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0] +; CHECK-NEXT: [N] -> { Stmt_for_j[i0, i1] -> MemRef_A[i1] }; %scevgep = getelementptr i64, i64* %A, i64 %indvar.j store i64 %init_sum, i64* %scevgep %indvar.j.next = add nsw i64 %indvar.j, 1 diff --git a/polly/test/TempScop/intra_bb_scalar_dep.ll b/polly/test/ScopInfo/intra_bb_scalar_dep.ll similarity index 83% rename from polly/test/TempScop/intra_bb_scalar_dep.ll rename to polly/test/ScopInfo/intra_bb_scalar_dep.ll index ed260eb53d6e..5476077511ff 100644 --- a/polly/test/TempScop/intra_bb_scalar_dep.ll +++ b/polly/test/ScopInfo/intra_bb_scalar_dep.ll @@ -32,9 +32,11 @@ for.j: ; preds = %for.j, %entry.next %init_plus_two = add i64 %init, 2 %scevgep = getelementptr i64, i64* %A, i64 %indvar.j store i64 %init_plus_two, i64* %scevgep -; CHECK: BB: for.j -; CHECK: Read init_ptr[0] -; CHECK: Write A[{0,+,8}<%for.j>] +; CHECK-LABEL: Stmt_for_j +; CHECK: ReadAccess := [Reduction Type: NONE] [Scalar: 0] +; CHECK-NEXT: [N] -> { Stmt_for_j[i0, i1] -> MemRef_init_ptr[0] }; +; CHECK: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0] +; CHECK-NEXT: [N] -> { Stmt_for_j[i0, i1] -> MemRef_A[i1] }; %indvar.j.next = add nsw i64 %indvar.j, 1 %exitcond.j = icmp eq i64 %indvar.j.next, %N br i1 %exitcond.j, label %for.i.end, label %for.j diff --git a/polly/test/TempScop/nested-loops.ll b/polly/test/ScopInfo/nested-loops.ll similarity index 100% rename from polly/test/TempScop/nested-loops.ll rename to polly/test/ScopInfo/nested-loops.ll diff --git a/polly/test/TempScop/not-a-reduction.ll b/polly/test/ScopInfo/not-a-reduction.ll similarity index 100% rename from polly/test/TempScop/not-a-reduction.ll rename to polly/test/ScopInfo/not-a-reduction.ll diff --git a/polly/test/TempScop/scalar_to_array.ll b/polly/test/ScopInfo/scalar_to_array.ll similarity index 78% rename from polly/test/TempScop/scalar_to_array.ll rename to polly/test/ScopInfo/scalar_to_array.ll index 0f139d80b887..e48545378115 100644 --- a/polly/test/TempScop/scalar_to_array.ll +++ b/polly/test/ScopInfo/scalar_to_array.ll @@ -5,7 +5,9 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3 @A = common global [1024 x float] zeroinitializer, align 8 -; CHECK: empty +; Terminating loops without side-effects will be optimzied away, hence +; detecting a scop would be pointless. +; CHECK-NOT: Function: empty ; Function Attrs: nounwind define i32 @empty() #0 { entry: @@ -29,7 +31,7 @@ return: ; preds = %for.cond ret i32 0 } -; CHECK: array_access +; CHECK-LABEL: Function: array_access ; Function Attrs: nounwind define i32 @array_access() #0 { entry: @@ -46,9 +48,10 @@ for.body: ; preds = %for.cond %float = uitofp i64 %indvar to float store float %float, float* %arrayidx br label %for.inc -; CHECK: BB: for.body -; CHECK-NOT: Read -; CHECK: Write A[{0,+,4}<%for.cond>] +; CHECK: Stmt_for_body +; CHECK-NOT: ReadAccess +; CHECK: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0] +; CHECK-NEXT: { Stmt_for_body[i0] -> MemRef_A[i0] }; for.inc: ; preds = %for.body %indvar.next = add i64 %indvar, 1 @@ -60,7 +63,7 @@ return: ; preds = %for.cond } ; Function Attrs: nounwind -; CHECK: intra_scop_dep +; CHECK-LABEL: Function: intra_scop_dep define i32 @intra_scop_dep() #0 { entry: fence seq_cst @@ -75,9 +78,11 @@ for.body.a: ; preds = %for.cond %arrayidx = getelementptr [1024 x float], [1024 x float]* @A, i64 0, i64 %indvar %scalar = load float, float* %arrayidx br label %for.body.b -; CHECK: BB: for.body.a -; CHECK: Read A[{0,+,4}<%for.cond>] -; CHECK: Write scalar[0] +; CHECK: Stmt_for_body_a +; CHECK: ReadAccess := [Reduction Type: NONE] [Scalar: 0] +; CHECK-NEXT: { Stmt_for_body_a[i0] -> MemRef_A[i0] }; +; CHECK: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1] +; CHECK-NEXT: { Stmt_for_body_a[i0] -> MemRef_scalar[] }; for.body.b: ; preds = %for.body.a %arrayidx2 = getelementptr [1024 x float], [1024 x float]* @A, i64 0, i64 %indvar @@ -85,9 +90,11 @@ for.body.b: ; preds = %for.body.a %sum = fadd float %scalar, %float store float %sum, float* %arrayidx2 br label %for.inc -; CHECK: BB: for.body.b -; CHECK: Read scalar[0] -; CHECK: Write A[{0,+,4}<%for.cond>] +; CHECK: Stmt_for_body_b +; CHECK: ReadAccess := [Reduction Type: NONE] [Scalar: 1] +; CHECK-NEXT: { Stmt_for_body_b[i0] -> MemRef_scalar[] }; +; CHECK: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0] +; CHECK-NEXT: { Stmt_for_body_b[i0] -> MemRef_A[i0] }; for.inc: ; preds = %for.body.b %indvar.next = add i64 %indvar, 1 @@ -104,7 +111,7 @@ return: ; preds = %for.cond ; Please note that this is still required when scalar to array rewritting is ; disabled. -; CHECK: use_after_scop +; CHECK-LABEL: Function: use_after_scop ; Function Attrs: nounwind define i32 @use_after_scop() #0 { entry: @@ -121,9 +128,11 @@ for.body: ; preds = %for.head %scalar = load float, float* %arrayidx store float %scalar, float* %scalar.s2a ; Escaped uses are still required to be rewritten to stack variable. -; CHECK: BB: for.body -; CHECK: Read A[{0,+,4}<%for.head>] -; CHECK: Write scalar.s2a[0] +; CHECK: Stmt_for_body +; CHECK: ReadAccess := [Reduction Type: NONE] [Scalar: 0] +; CHECK-NEXT: { Stmt_for_body[i0] -> MemRef_A[i0] }; +; CHECK: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0] +; CHECK-NEXT: { Stmt_for_body[i0] -> MemRef_scalar_s2a[0] }; br label %for.inc for.inc: ; preds = %for.body @@ -149,7 +158,7 @@ return: ; preds = %for.after ; o For integer values, such a translation may block the use of scalar ; evolution on those values. ; -; CHECK: before_scop +; CHECK-LABEL: Function: before_scop ; Function Attrs: nounwind define i32 @before_scop() #0 { entry: @@ -169,8 +178,9 @@ for.body: ; preds = %for.cond %arrayidx = getelementptr [1024 x float], [1024 x float]* @A, i64 0, i64 %indvar store float %scalar, float* %arrayidx br label %for.inc -; CHECK: BB: for.body -; CHECK: Write A[{0,+,4}<%for.cond>] +; CHECK: Stmt_for_body +; CHECK: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0] +; CHECK-NEXT: { Stmt_for_body[i0] -> MemRef_A[i0] }; for.inc: ; preds = %for.body %indvar.next = add i64 %indvar, 1 diff --git a/polly/test/TempScop/tempscop-printing.ll b/polly/test/ScopInfo/tempscop-printing.ll similarity index 58% rename from polly/test/TempScop/tempscop-printing.ll rename to polly/test/ScopInfo/tempscop-printing.ll index e01832734720..52027fef257b 100644 --- a/polly/test/TempScop/tempscop-printing.ll +++ b/polly/test/ScopInfo/tempscop-printing.ll @@ -1,4 +1,4 @@ -; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-scops -analyze < %s | FileCheck %s -check-prefix=SCALARACCESS +; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-scops -analyze < %s | FileCheck %s ; void f(long A[], int N, int *init_ptr) { ; long i, j; @@ -13,6 +13,7 @@ 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" +; CHECK-LABEL: Function: f define void @f(i64* noalias %A, i64 %N, i64* noalias %init_ptr) nounwind { entry: br label %for.i @@ -23,17 +24,21 @@ for.i: br label %entry.next entry.next: -; SCALARACCESS: BB: entry.next +; CHECK: Stmt_entry_next %init = load i64, i64* %init_ptr -; SCALARACCESS: Read init_ptr[0] -; SCALARACCESS: Write init[0] +; CHECK: ReadAccess := [Reduction Type: NONE] [Scalar: 0] +; CHECK-NEXT: [N] -> { Stmt_entry_next[i0] -> MemRef_init_ptr[0] }; +; CHECK: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1] +; CHECK-NEXT: [N] -> { Stmt_entry_next[i0] -> MemRef_init[] }; br label %for.j for.j: %indvar.j = phi i64 [ 0, %entry.next ], [ %indvar.j.next, %for.j ] -; SCALARACCESS: BB: for.j -; SCALARACCESS: Read init -; SCALARACCESS: Write A[{0,+,8}<%for.j>] +; CHECK: Stmt_for_j +; CHECK: ReadAccess := [Reduction Type: NONE] [Scalar: 1] +; CHECK-NEXT: [N] -> { Stmt_for_j[i0, i1] -> MemRef_init[] }; +; CHECK: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0] +; CHECK-NEXT: [N] -> { Stmt_for_j[i0, i1] -> MemRef_A[i1] }; %init_plus_two = add i64 %init, 2 %scevgep = getelementptr i64, i64* %A, i64 %indvar.j store i64 %init_plus_two, i64* %scevgep @@ -49,6 +54,7 @@ return: ret void } +; CHECK-LABEL: Function: g define void @g(i64* noalias %A, i64 %N, i64* noalias %init_ptr) nounwind { entry: br label %for.i @@ -59,19 +65,23 @@ for.i: br label %entry.next entry.next: -; SCALARACCESS: BB: entry.next +; CHECK: Stmt_entry_next %init = load i64, i64* %init_ptr -; SCALARACCESS: Read init_ptr[0] -; SCALARACCESS: Write init[0] +; CHECK: ReadAccess := [Reduction Type: NONE] [Scalar: 0] +; CHECK-NEXT: [N] -> { Stmt_entry_next[i0] -> MemRef_init_ptr[0] }; +; CHECK: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1] +; CHECK-NEXT: [N] -> { Stmt_entry_next[i0] -> MemRef_init[] }; br label %for.j for.j: -; SCALARACCESS: BB: for.j +; CHECK: Stmt_for_j %indvar.j = phi i64 [ 0, %entry.next ], [ %indvar.j.next, %for.j ] %scevgep = getelementptr i64, i64* %A, i64 %indvar.j store i64 %init, i64* %scevgep -; SCALARACCESS: Read init -; SCALARACCESS: Write A[{0,+,8}<%for.j>] +; CHECK: ReadAccess := [Reduction Type: NONE] [Scalar: 1] +; CHECK-NEXT: [N] -> { Stmt_for_j[i0, i1] -> MemRef_init[] }; +; CHECK: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0] +; CHECK-NEXT: [N] -> { Stmt_for_j[i0, i1] -> MemRef_A[i1] }; %indvar.j.next = add nsw i64 %indvar.j, 1 %exitcond.j = icmp eq i64 %indvar.j.next, %N br i1 %exitcond.j, label %for.i.end, label %for.j