| 1 |
/*========================== begin_copyright_notice ============================ |
| 2 |
|
| 3 |
Copyright (C) 2024 Intel Corporation |
| 4 |
|
| 5 |
SPDX-License-Identifier: MIT |
| 6 |
|
| 7 |
============================= end_copyright_notice ===========================*/ |
| 8 |
|
| 9 |
/*========================== begin_copyright_notice ============================ |
| 10 |
|
| 11 |
Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 12 |
See https://llvm.org/LICENSE.txt for license information. |
| 13 |
SPDX-License-Identifier: Apache-2.0 with LLVM-exception |
| 14 |
|
| 15 |
============================= end_copyright_notice ===========================*/ |
| 16 |
|
| 17 |
From d39249a7ba290d8b6b57a12cb9860682f34c1952 Mon Sep 17 00:00:00 2001 |
| 18 |
From: Florian Hahn <[email protected]> |
| 19 |
Date: Mon, 10 Oct 2022 20:42:18 +0100 |
| 20 |
Subject: [PATCH 2/5] [SCEV] Verify block disposition cache. |
| 21 |
|
| 22 |
This extends the existing SCEV verification to catch cache invalidation |
| 23 |
issues as in #57837. |
| 24 |
|
| 25 |
The validation logic is similar to the recently added loop disposition |
| 26 |
cache validation in bb68b2402daa9. |
| 27 |
|
| 28 |
Reviewed By: nikic |
| 29 |
|
| 30 |
Differential Revision: https://reviews.llvm.org/D134531 |
| 31 |
--- |
| 32 |
llvm/lib/Analysis/ScalarEvolution.cpp | 16 ++++++++++++++++ |
| 33 |
1 file changed, 16 insertions(+) |
| 34 |
|
| 35 |
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp |
| 36 |
index 1d887d4b60c9..495cd73d8eef 100644 |
| 37 |
--- a/llvm/lib/Analysis/ScalarEvolution.cpp |
| 38 |
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp |
| 39 |
@@ -13467,6 +13467,22 @@ void ScalarEvolution::verify() const { |
| 40 |
} |
| 41 |
} |
| 42 |
} |
| 43 |
+ |
| 44 |
+ // Verify integrity of the block disposition cache. |
| 45 |
+ for (const auto &It : BlockDispositions) { |
| 46 |
+ const SCEV *S = It.first; |
| 47 |
+ auto &Values = It.second; |
| 48 |
+ for (auto &V : Values) { |
| 49 |
+ auto CachedDisposition = V.getInt(); |
| 50 |
+ const BasicBlock *BB = V.getPointer(); |
| 51 |
+ const auto RecomputedDisposition = SE2.getBlockDisposition(S, BB); |
| 52 |
+ if (CachedDisposition != RecomputedDisposition) { |
| 53 |
+ dbgs() << "Cached disposition of " << *S << " for block %" |
| 54 |
+ << BB->getName() << " is incorrect! \n"; |
| 55 |
+ std::abort(); |
| 56 |
+ } |
| 57 |
+ } |
| 58 |
+ } |
| 59 |
} |
| 60 |
|
| 61 |
bool ScalarEvolution::invalidate( |
| 62 |
-- |
| 63 |
2.34.1 |
| 64 |
|