[PATCH] D134158: [SCEV] Verify contents of loop disposition cache

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 19 03:49:57 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rGbb68b2402daa: [SCEV] Verify contents of loop disposition cache (authored by mkazantsev).

Changed prior to commit:
  https://reviews.llvm.org/D134158?vs=461168&id=461176#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D134158/new/

https://reviews.llvm.org/D134158

Files:
  llvm/lib/Analysis/ScalarEvolution.cpp
  llvm/test/Transforms/LoopFusion/double_loop_nest_inner_guard.ll
  llvm/test/Transforms/LoopFusion/loop_nest.ll
  llvm/test/Transforms/LoopFusion/triple_loop_nest_inner_guard.ll


Index: llvm/test/Transforms/LoopFusion/triple_loop_nest_inner_guard.ll
===================================================================
--- llvm/test/Transforms/LoopFusion/triple_loop_nest_inner_guard.ll
+++ llvm/test/Transforms/LoopFusion/triple_loop_nest_inner_guard.ll
@@ -1,4 +1,7 @@
 ; RUN: opt -S -loop-fusion < %s 2>&1 | FileCheck %s
+; XFAIL: *
+; REQUIRES: asserts
+; Fails due to incorrect cached loop disposition.
 
 ; Verify that LoopFusion can fuse two triple-loop nests with guarded inner
 ; loops. Loops are in canonical form.
Index: llvm/test/Transforms/LoopFusion/loop_nest.ll
===================================================================
--- llvm/test/Transforms/LoopFusion/loop_nest.ll
+++ llvm/test/Transforms/LoopFusion/loop_nest.ll
@@ -1,4 +1,7 @@
 ; RUN: opt -S -loop-fusion < %s | FileCheck %s
+; XFAIL: *
+; REQUIRES: asserts
+; Fails due to incorrect cached loop disposition.
 ;
 ;    int A[1024][1024];
 ;    int B[1024][1024];
Index: llvm/test/Transforms/LoopFusion/double_loop_nest_inner_guard.ll
===================================================================
--- llvm/test/Transforms/LoopFusion/double_loop_nest_inner_guard.ll
+++ llvm/test/Transforms/LoopFusion/double_loop_nest_inner_guard.ll
@@ -1,4 +1,7 @@
 ; RUN: opt -S -loop-fusion < %s 2>&1 | FileCheck %s
+; XFAIL: *
+; REQUIRES: asserts
+; Fails due to incorrect cached loop disposition.
 
 ; Verify that LoopFusion can fuse two double-loop nests with guarded inner
 ; loops. Loops are in canonical form.
Index: llvm/lib/Analysis/ScalarEvolution.cpp
===================================================================
--- llvm/lib/Analysis/ScalarEvolution.cpp
+++ llvm/lib/Analysis/ScalarEvolution.cpp
@@ -13968,6 +13968,24 @@
   };
   VerifyBECountUsers(/* Predicated */ false);
   VerifyBECountUsers(/* Predicated */ true);
+
+  // Verify intergity of loop disposition cache.
+  for (const auto &It : LoopDispositions) {
+    const SCEV *S = It.first;
+    auto &Values = It.second;
+    for (auto &V : Values) {
+      auto CachedDisposition = V.getInt();
+      const auto *Loop = V.getPointer();
+      const auto RecomputedDisposition = SE2.getLoopDisposition(S, Loop);
+      if (CachedDisposition != RecomputedDisposition) {
+        dbgs() << "Cached disposition of " << *S << " for loop " << *Loop
+               << " is incorrect: cached "
+               << loopDispositionToStr(CachedDisposition) << ", actual "
+               << loopDispositionToStr(RecomputedDisposition) << "\n";
+        std::abort();
+      }
+    }
+  }
 }
 
 bool ScalarEvolution::invalidate(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134158.461176.patch
Type: text/x-patch
Size: 2586 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220919/ee282f65/attachment.bin>


More information about the llvm-commits mailing list