[polly] r311692 - Revert "[polly] Fix ScopDetectionDiagnostic test failure caused by r310940"

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 24 14:40:25 PDT 2017


You are right. This slipped through. Sorry.

Best,
Tobias

On Thu, Aug 24, 2017, at 23:39, Michael Kruse wrote:
> Reminder to use svn revision numbers instead of sha1 hashes.
> 
> Michael
> 
> 
> 
> Le 24 août 2017 9:48 PM, "Tobias Grosser via llvm-commits" <
> llvm-commits at lists.llvm.org> a écrit :
> 
> Author: grosser
> Date: Thu Aug 24 12:47:15 2017
> New Revision: 311692
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=311692&view=rev
> Log:
> Revert "[polly] Fix ScopDetectionDiagnostic test failure caused by
> r310940"
> 
> This reverts commit 950849ece9bb8fdd2b41e3ec348b9653b4e37df6.
> 
> This commit broke various buildbots.
> 
> Modified:
>     polly/trunk/include/polly/ScopDetectionDiagnostic.h
>     polly/trunk/lib/Analysis/ScopDetection.cpp
>     polly/trunk/lib/Analysis/ScopDetectionDiagnostic.cpp
>     polly/trunk/test/ScopDetectionDiagnostics/ReportLoopHasNoExit.ll
> 
> Modified: polly/trunk/include/polly/ScopDetectionDiagnostic.h
> URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/
> polly/ScopDetectionDiagnostic.h?rev=311692&r1=311691&r2=311692&view=diff
> ============================================================
> ==================
> --- polly/trunk/include/polly/ScopDetectionDiagnostic.h (original)
> +++ polly/trunk/include/polly/ScopDetectionDiagnostic.h Thu Aug 24
> 12:47:15
> 2017
> @@ -86,6 +86,7 @@ enum class RejectReasonKind {
>    LastAffFunc,
> 
>    LoopBound,
> +  LoopHasNoExit,
>    LoopOnlySomeLatches,
> 
>    FuncCall,
> @@ -563,6 +564,36 @@ public:
> 
>    /// @name LLVM-RTTI interface
>    //@{
> +  static bool classof(const RejectReason *RR);
> +  //@}
> +
> +  /// @name RejectReason interface
> +  //@{
> +  virtual std::string getRemarkName() const override;
> +  virtual const Value *getRemarkBB() const override;
> +  virtual std::string getMessage() const override;
> +  virtual const DebugLoc &getDebugLoc() const override;
> +  virtual std::string getEndUserMessage() const override;
> +  //@}
> +};
> +
> +//===------------------------------------------------------
> ----------------===//
> +/// Captures errors when loop has no exit.
> +class ReportLoopHasNoExit : public RejectReason {
> +  //===-------------------------------------------------------
> -------------===//
> +
> +  /// The loop that has no exit.
> +  Loop *L;
> +
> +  const DebugLoc Loc;
> +
> +public:
> +  ReportLoopHasNoExit(Loop *L)
> +      : RejectReason(RejectReasonKind::LoopHasNoExit), L(L),
> +        Loc(L->getStartLoc()) {}
> +
> +  /// @name LLVM-RTTI interface
> +  //@{
>    static bool classof(const RejectReason *RR);
>    //@}
> 
> 
> Modified: polly/trunk/lib/Analysis/ScopDetection.cpp
> URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/
> Analysis/ScopDetection.cpp?rev=311692&r1=311691&r2=311692&view=diff
> ============================================================
> ==================
> --- polly/trunk/lib/Analysis/ScopDetection.cpp (original)
> +++ polly/trunk/lib/Analysis/ScopDetection.cpp Thu Aug 24 12:47:15 2017
> @@ -1166,6 +1166,17 @@ bool ScopDetection::isValidInstruction(I
>    return invalid<ReportUnknownInst>(Context, /*Assert=*/true, &Inst);
>  }
> 
> +/// Check whether @p L has exiting blocks.
> +///
> +/// @param L The loop of interest
> +///
> +/// @return True if the loop has exiting blocks, false otherwise.
> +static bool hasExitingBlocks(Loop *L) {
> +  SmallVector<BasicBlock *, 4> ExitingBlocks;
> +  L->getExitingBlocks(ExitingBlocks);
> +  return !ExitingBlocks.empty();
> +}
> +
>  bool ScopDetection::canUseISLTripCount(Loop *L,
>                                         DetectionContext &Context) const
>                                         {
>    // Ensure the loop has valid exiting blocks as well as latches,
> otherwise we
> @@ -1186,18 +1197,34 @@ bool ScopDetection::isValidLoop(Loop *L,
>    // Loops that contain part but not all of the blocks of a region
>    cannot
> be
>    // handled by the schedule generation. Such loop constructs can happen
>    // because a region can contain BBs that have no path to the exit
>    block
> -  // (infinite loops, UnreachableInst).
> -  // We do not have to verify against infinite loops here -- they are
> -  // postdominated only by the virtual exit and do not appear in
> regions.
> -  // Instead of an infinite loop, a dead end can also be formed by an
> -  // UnreachableInst. This case is already caught by isErrorBlock().
> -
> -#ifndef NDEBUG
> -  // Make sure that the loop has exits (i.e. is not infinite).
> -  SmallVector<BasicBlock *, 4> ExitingBlocks;
> -  L->getExitingBlocks(ExitingBlocks);
> -  assert(!ExitingBlocks.empty() && "Region with an infinite loop
> found!");
> -#endif
> +  // (Infinite loops, UnreachableInst), but such blocks are never part
> of a
> +  // loop.
> +  //
> +  // _______________
> +  // | Loop Header | <-----------.
> +  // ---------------             |
> +  //        |                    |
> +  // _______________       ______________
> +  // | RegionEntry |-----> | RegionExit |----->
> +  // ---------------       --------------
> +  //        |
> +  // _______________
> +  // | EndlessLoop | <--.
> +  // ---------------    |
> +  //       |            |
> +  //       \------------/
> +  //
> +  // In the example above, the loop (LoopHeader,RegionEntry,RegionExit)
> is
> +  // neither entirely contained in the region RegionEntry->RegionExit
> +  // (containing RegionEntry,EndlessLoop) nor is the region entirely
> contained
> +  // in the loop.
> +  // The block EndlessLoop is contained in the region because
> Region::contains
> +  // tests whether it is not dominated by RegionExit. This is probably
> to
> not
> +  // having to query the PostdominatorTree. Instead of an endless loop,
> a
> dead
> +  // end can also be formed by an UnreachableInst. This case is already
> caught
> +  // by isErrorBlock(). We hence only have to reject endless loops here.
> +  if (!hasExitingBlocks(L))
> +    return invalid<ReportLoopHasNoExit>(Context, /*Assert=*/true, L);
> 
>    if (canUseISLTripCount(L, Context))
>      return true;
> 
> Modified: polly/trunk/lib/Analysis/ScopDetectionDiagnostic.cpp
> URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/
> ScopDetectionDiagnostic.cpp?rev=311692&r1=311691&r2=311692&view=diff
> ============================================================
> ==================
> --- polly/trunk/lib/Analysis/ScopDetectionDiagnostic.cpp (original)
> +++ polly/trunk/lib/Analysis/ScopDetectionDiagnostic.cpp Thu Aug 24
> 12:47:15 2017
> @@ -60,6 +60,7 @@ llvm::Statistic RejectStatistics[] = {
>      SCOP_STAT(DifferentElementSize, "Accesses with differing sizes"),
>      SCOP_STAT(LastAffFunc, ""),
>      SCOP_STAT(LoopBound, "Uncomputable loop bounds"),
> +    SCOP_STAT(LoopHasNoExit, "Loop without exit"),
>      SCOP_STAT(LoopOnlySomeLatches, "Not all loop latches in scop"),
>      SCOP_STAT(FuncCall, "Function call with side effects"),
>      SCOP_STAT(NonSimpleMemoryAccess,
> @@ -459,6 +460,29 @@ std::string ReportLoopBound::getEndUserM
>  }
> 
>  //===-------------------------------------------------------
> ---------------===//
> +// ReportLoopHasNoExit.
> +
> +std::string ReportLoopHasNoExit::getRemarkName() const {
> +  return "LoopHasNoExit";
> +}
> +
> +const Value *ReportLoopHasNoExit::getRemarkBB() const { return
> L->getHeader(); }
> +
> +std::string ReportLoopHasNoExit::getMessage() const {
> +  return "Loop " + L->getHeader()->getName() + " has no exit.";
> +}
> +
> +bool ReportLoopHasNoExit::classof(const RejectReason *RR) {
> +  return RR->getKind() == RejectReasonKind::LoopHasNoExit;
> +}
> +
> +const DebugLoc &ReportLoopHasNoExit::getDebugLoc() const { return Loc; }
> +
> +std::string ReportLoopHasNoExit::getEndUserMessage() const {
> +  return "Loop cannot be handled because it has no exit.";
> +}
> +
> +//===------------------------------------------------------
> ----------------===//
>  // ReportLoopOnlySomeLatches
> 
>  std::string ReportLoopOnlySomeLatches::getRemarkName() const {
> @@ -475,7 +499,7 @@ std::string ReportLoopOnlySomeLatches::g
>  }
> 
>  bool ReportLoopOnlySomeLatches::classof(const RejectReason *RR) {
> -  return RR->getKind() == RejectReasonKind::LoopOnlySomeLatches;
> +  return RR->getKind() == RejectReasonKind::LoopHasNoExit;
>  }
> 
>  const DebugLoc &ReportLoopOnlySomeLatches::getDebugLoc() const { return
> Loc; }
> 
> Modified:
> polly/trunk/test/ScopDetectionDiagnostics/ReportLoopHasNoExit.ll
> URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/
> ScopDetectionDiagnostics/ReportLoopHasNoExit.ll?rev=
> 311692&r1=311691&r2=311692&view=diff
> ============================================================
> ==================
> --- polly/trunk/test/ScopDetectionDiagnostics/ReportLoopHasNoExit.ll
> (original)
> +++ polly/trunk/test/ScopDetectionDiagnostics/ReportLoopHasNoExit.ll Thu
> Aug 24 12:47:15 2017
> @@ -1,7 +1,7 @@
>  ; XFAIL: *
> 
>  ; The test case stopped making sense after r310940 that added infinite
> loops to
> -; the PostDominatorTree. Infinite loops are postdominated only by the
> virtual
> +; the PostDominatorTree. Infinite loops are postdominated ony by the
> virtual
>  ; root, which causes them not to appear in regions in ScopDetection
> anymore.
> 
>  ; RUN: opt %loadPolly -pass-remarks-missed="polly-detect"
> -polly-allow-nonaffine-loops -analyze  -polly-detect < %s 2>&1 |
> FileCheck
> %s
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list