[llvm] [NFC] Prefer isSafeToSpeculativelyExecute to div/rem (PR #91157)

via llvm-commits llvm-commits at lists.llvm.org
Sun May 5 18:33:50 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff e12364301e3370456e610c3f23ca18050f61f77e 115e006b584e0d44f1b40697c198900cb4449d35 -- llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
index fa76855415..167043b6b4 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
@@ -3802,7 +3802,8 @@ Instruction *InstCombinerImpl::visitSelectInst(SelectInst &SI) {
   // preventing a division-by-zero.
   // select(C, binop(select(C, X, Y), W), Z) -> select(C, binop(X, W), Z)
   BinaryOperator *TrueBO;
-  if (match(TrueVal, m_OneUse(m_BinOp(TrueBO))) && isSafeToSpeculativelyExecute(TrueBO)) {
+  if (match(TrueVal, m_OneUse(m_BinOp(TrueBO))) &&
+      isSafeToSpeculativelyExecute(TrueBO)) {
     if (auto *TrueBOSI = dyn_cast<SelectInst>(TrueBO->getOperand(0))) {
       if (TrueBOSI->getCondition() == CondVal) {
         replaceOperand(*TrueBO, 0, TrueBOSI->getTrueValue());

``````````

</details>


https://github.com/llvm/llvm-project/pull/91157


More information about the llvm-commits mailing list