[llvm] [InstCombine] Avoid folding `select(umin(X, Y), X)` with non-constant mask (PR #143020)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 5 12:02:00 PDT 2025
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 HEAD~1 HEAD --extensions cpp -- llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
index 930819d24..0e5c95c74 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -1655,7 +1655,8 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
return visitFree(CI, FreedOp);
if (Function *F = CI.getCalledFunction()) {
- if (F->getIntrinsicID() == Intrinsic::umin || F->getIntrinsicID() == Intrinsic::umax) {
+ if (F->getIntrinsicID() == Intrinsic::umin ||
+ F->getIntrinsicID() == Intrinsic::umax) {
for (Value *Arg : CI.args()) {
auto *SI = dyn_cast<SelectInst>(Arg);
if (!SI)
@@ -1665,8 +1666,11 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
auto *FalseC = dyn_cast<Constant>(SI->getFalseValue());
// Block only if the select is masking, e.g. select(cond, val, -1)
- if ((TrueC && TrueC->isAllOnesValue()) || (FalseC && FalseC->isAllOnesValue())) {
- LLVM_DEBUG(dbgs() << "InstCombine: skipping umin/umax folding for masked select\n");
+ if ((TrueC && TrueC->isAllOnesValue()) ||
+ (FalseC && FalseC->isAllOnesValue())) {
+ LLVM_DEBUG(
+ dbgs()
+ << "InstCombine: skipping umin/umax folding for masked select\n");
return nullptr;
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/143020
More information about the llvm-commits
mailing list