Debian Codegraph @

external/llvm/releases/14.0.0/patches_external/0004-SCEV-Cache-ZExt-SCEV-expressions.patch

raw
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 e151e07932d68201fe228508fe776f7550150665 Mon Sep 17 00:00:00 2001
18 From: Max Kazantsev <[email protected]>
19 Date: Mon, 19 Sep 2022 17:37:17 +0700
20 Subject: [PATCH 1/5] [SCEV] Verify contents of loop disposition cache
21
22 It seems that it is sometimes broken. Initial motivation for this was
23 investigation of https://github.com/llvm/llvm-project/issues/56260, but
24 it also seems that we have found an unrelated bug in LoopFusion that leaves
25 broken caches.
26
27 Differential Revision: https://reviews.llvm.org/D134158
28 Reviewed By: nikic
29 ---
30 llvm/lib/Analysis/ScalarEvolution.cpp | 18 ++++++++++++++++++
31 1 file changed, 18 insertions(+)
32
33 diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
34 index 977fc0911355..1d887d4b60c9 100644
35 --- a/llvm/lib/Analysis/ScalarEvolution.cpp
36 +++ b/llvm/lib/Analysis/ScalarEvolution.cpp
37 @@ -13449,6 +13449,24 @@ void ScalarEvolution::verify() const {
38 };
39 VerifyBECountUsers(/* Predicated */ false);
40 VerifyBECountUsers(/* Predicated */ true);
41 +
42 + // Verify intergity of loop disposition cache.
43 + for (const auto &It : LoopDispositions) {
44 + const SCEV *S = It.first;
45 + auto &Values = It.second;
46 + for (auto &V : Values) {
47 + auto CachedDisposition = V.getInt();
48 + const auto *Loop = V.getPointer();
49 + const auto RecomputedDisposition = SE2.getLoopDisposition(S, Loop);
50 + if (CachedDisposition != RecomputedDisposition) {
51 + dbgs() << "Cached disposition of " << *S << " for loop " << *Loop
52 + << " is incorrect: cached "
53 + << loopDispositionToStr(CachedDisposition) << ", actual "
54 + << loopDispositionToStr(RecomputedDisposition) << "\n";
55 + std::abort();
56 + }
57 + }
58 + }
59 }
60
61 bool ScalarEvolution::invalidate(
62 --
63 2.34.1
64