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