diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp --- a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp @@ -1123,7 +1123,7 @@ // else. Only do this if CmpRHS is a constant, as profitability is not // clear for other cases. // FIXME: The replacement could be performed recursively. - if (isa(CmpRHS) && !isa(CmpRHS)) + if (match(CmpRHS, m_ImmConstant()) && !match(CmpLHS, m_ImmConstant())) if (auto *I = dyn_cast(TrueVal)) if (I->hasOneUse()) for (Use &U : I->operands())