[llvm] [InstCombine] Fold selects into masked loads (PR #160522)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 24 06:30:52 PDT 2025
================
@@ -4611,5 +4611,16 @@ Instruction *InstCombinerImpl::visitSelectInst(SelectInst &SI) {
return replaceOperand(SI, 2, ConstantInt::get(FalseVal->getType(), 0));
}
+ Value *MaskedLoadPtr;
+ const APInt *MaskedLoadAlignment;
+ if (match(TrueVal,
+ m_MaskedLoad(m_Value(MaskedLoadPtr), m_APInt(MaskedLoadAlignment),
+ m_Specific(CondVal), m_Value())))
----------------
nikic wrote:
Needs a one-use check? Otherwise you'll end up with two masked loads.
https://github.com/llvm/llvm-project/pull/160522
More information about the llvm-commits
mailing list