Debian Codegraph @

external/llvm/releases/14.0.0/patches_external/Remove-too-strict-restrictions-in-LICM-pass.patch

raw
1 /*========================== begin_copyright_notice ============================
2
3 Copyright (C) 2023 Intel Corporation
4
5 SPDX-License-Identifier: MIT
6
7 ============================= end_copyright_notice ===========================*/
8
9 From 8b66a82ac8c802cc67b4c73667acb6a1d769ae5f Mon Sep 17 00:00:00 2001
10 From: Marcin Naczk <[email protected]>
11 Date: Wed, 22 Feb 2023 15:33:37 +0100
12 Subject: [PATCH] Remove too strict restrictions in LICM pass.
13
14 The reason for removal of below condition was that it took a very strict
15 approach to the Convergent attribute, which caused missed optimization
16 opportunities in cases where it was safe to do so.
17 The decision is based on the discussion in LLVM RFC
18 https://reviews.llvm.org/D90361?id=303195
19 This patch should be considered obsolete if LICM introduces a more
20 advanced approach to the Convergent attribute in the future version of
21 LLVM.
22 ---
23 llvm/lib/Transforms/Scalar/LICM.cpp | 14 ++++++++++++--
24 1 file changed, 12 insertions(+), 2 deletions(-)
25
26 diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp
27 index 6372ce19f..39d11d7b2 100644
28 --- a/llvm/lib/Transforms/Scalar/LICM.cpp
29 +++ b/llvm/lib/Transforms/Scalar/LICM.cpp
30 @@ -1196,8 +1196,18 @@ bool llvm::canSinkOrHoistInst(Instruction &I, AAResults *AA, DominatorTree *DT,
31 // inter-thread communication which results are implicitly affected by the
32 // enclosing control flows. It is not safe to hoist or sink such operations
33 // across control flow.
34 - if (CI->isConvergent())
35 - return false;
36 +
37 + // The reason for removal of below condition was that it took a very strict
38 + // approach to the Convergent attribute, which caused missed optimization
39 + // opportunities in cases where it was safe to do so.
40 + // The decision is based on the discussion in LLVM RFC
41 + // https://reviews.llvm.org/D90361?id=303195
42 + // This patch should be considered obsolete if LICM introduces a more
43 + // advanced approach to the Convergent attribute in the future version of
44 + // LLVM.
45 +
46 + //if (CI->isConvergent())
47 + // return false;
48
49 using namespace PatternMatch;
50 if (match(CI, m_Intrinsic<Intrinsic::assume>()))
51 --
52 2.33.0.windows.1
53