diff options
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp')
-rw-r--r-- | contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp b/contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp index 0620752e3213..5fd944a859ef 100644 --- a/contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp +++ b/contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp @@ -2809,6 +2809,10 @@ static Instruction *matchFunnelShift(Instruction &Or, InstCombinerImpl &IC, match(R, m_And(m_Neg(m_Specific(X)), m_SpecificInt(Mask)))) return X; + // (shl ShVal, X) | (lshr ShVal, ((-X) & (Width - 1))) + if (match(R, m_And(m_Neg(m_Specific(L)), m_SpecificInt(Mask)))) + return L; + // Similar to above, but the shift amount may be extended after masking, // so return the extended value as the parameter for the intrinsic. if (match(L, m_ZExt(m_And(m_Value(X), m_SpecificInt(Mask)))) && @@ -3398,6 +3402,9 @@ Instruction *InstCombinerImpl::visitOr(BinaryOperator &I) { if (Instruction *R = foldBinOpShiftWithShift(I)) return R; + if (Instruction *R = tryFoldInstWithCtpopWithNot(&I)) + return R; + Value *X, *Y; const APInt *CV; if (match(&I, m_c_Or(m_OneUse(m_Xor(m_Value(X), m_APInt(CV))), m_Value(Y))) && |