| 1 |
/*========================== begin_copyright_notice ============================ |
| 2 |
|
| 3 |
Copyright (C) 2025 Intel Corporation |
| 4 |
|
| 5 |
SPDX-License-Identifier: MIT |
| 6 |
|
| 7 |
============================= end_copyright_notice ===========================*/ |
| 8 |
|
| 9 |
The reason for removal of below condition was that it took a very strict |
| 10 |
approach to the Convergent attribute, which caused missed optimization |
| 11 |
opportunities in cases where it was safe to do so. |
| 12 |
The decision is based on the discussion in LLVM RFC |
| 13 |
https://reviews.llvm.org/D90361?id=303195 |
| 14 |
This patch should be considered obsolete if LICM introduces a more |
| 15 |
advanced approach to the Convergent attribute in the future version of |
| 16 |
LLVM. |
| 17 |
--- |
| 18 |
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp |
| 19 |
index 2865dece8..f879176b3 100644 |
| 20 |
--- a/llvm/lib/Transforms/Scalar/LICM.cpp |
| 21 |
+++ b/llvm/lib/Transforms/Scalar/LICM.cpp |
| 22 |
@@ -1202,8 +1202,18 @@ bool llvm::canSinkOrHoistInst(Instruction &I, AAResults *AA, DominatorTree *DT, |
| 23 |
// inter-thread communication which results are implicitly affected by the |
| 24 |
// enclosing control flows. It is not safe to hoist or sink such operations |
| 25 |
// across control flow. |
| 26 |
- if (CI->isConvergent()) |
| 27 |
- return false; |
| 28 |
+ |
| 29 |
+ // The reason for removal of below condition was that it took a very strict |
| 30 |
+ // approach to the Convergent attribute, which caused missed optimization |
| 31 |
+ // opportunities in cases where it was safe to do so. |
| 32 |
+ // The decision is based on the discussion in LLVM RFC |
| 33 |
+ // https://reviews.llvm.org/D90361?id=303195 |
| 34 |
+ // This patch should be considered obsolete if LICM introduces a more |
| 35 |
+ // advanced approach to the Convergent attribute in the future version of |
| 36 |
+ // LLVM. |
| 37 |
+ |
| 38 |
+ //if (CI->isConvergent()) |
| 39 |
+ // return false; |
| 40 |
|
| 41 |
using namespace PatternMatch; |
| 42 |
if (match(CI, m_Intrinsic<Intrinsic::assume>())) |
| 43 |
|