[llvm] [InstCombine] Add missing fold for `fsqrt(select(b, c1, c2)) => select(b, fsqrt(c1), fsqrt(c2))` (PR #113084)

via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 20 06:20:43 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 1bbf3a37056761ec407031431e28f856428566f0 711b46bac66590f84c67ddee9e359435df7b93aa --extensions cpp -- llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
index 911e5baba8..a4ca9315e4 100644
--- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -1701,9 +1701,12 @@ Instruction *InstCombinerImpl::FoldOpIntoSelect(Instruction &Op, SelectInst *SI,
 
   if (auto *II = dyn_cast<IntrinsicInst>(&Op)) {
     if (II->getIntrinsicID() == Intrinsic::sqrt) {
-      Value *NewTV = Builder.CreateUnaryIntrinsic(Intrinsic::sqrt, TV, nullptr, "sqrt_fold");
-      Value *NewFV = Builder.CreateUnaryIntrinsic(Intrinsic::sqrt, FV, nullptr, "sqrt_fold");
-      return SelectInst::Create(SI->getCondition(), NewTV, NewFV, "", nullptr, SI);
+      Value *NewTV = Builder.CreateUnaryIntrinsic(Intrinsic::sqrt, TV, nullptr,
+                                                  "sqrt_fold");
+      Value *NewFV = Builder.CreateUnaryIntrinsic(Intrinsic::sqrt, FV, nullptr,
+                                                  "sqrt_fold");
+      return SelectInst::Create(SI->getCondition(), NewTV, NewFV, "", nullptr,
+                                SI);
     }
   }
 

``````````

</details>


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


More information about the llvm-commits mailing list