[llvm] [InstCombine] Enable FoldOpIntoSelect and foldOpIntoPhi when the Op's other parameter is non-const (PR #166102)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 1 08:04:39 PST 2025
================
@@ -2261,11 +2261,11 @@ Instruction *InstCombinerImpl::foldBinopWithPhiOperands(BinaryOperator &BO) {
}
Instruction *InstCombinerImpl::foldBinOpIntoSelectOrPhi(BinaryOperator &I) {
- if (!isa<Constant>(I.getOperand(1)))
- return nullptr;
+ bool IsOtherParamConst = isa<Constant>(I.getOperand(1));
if (auto *Sel = dyn_cast<SelectInst>(I.getOperand(0))) {
----------------
nikic wrote:
This code previously relied on constants being canonicalized to the RHS, so we only had to check for the select on the LHS. However, extended to non-constants, shouldn't we be checking both operands now?
https://github.com/llvm/llvm-project/pull/166102
More information about the llvm-commits
mailing list