[llvm] [InstCombine] Combine trunc (lshr X, BW-1) to i1 --> icmp slt X, 0 (#142593) (PR #143846)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 13 06:01:44 PDT 2025
================
@@ -815,6 +815,13 @@ Instruction *InstCombinerImpl::visitTrunc(TruncInst &Trunc) {
return new ICmpInst(ICmpInst::ICMP_EQ, X, CmpC);
}
+ if (match(Src, m_AShr(m_Value(X), m_SpecificInt(SrcWidth - 1))) ||
+ match(Src, m_LShr(m_Value(X), m_SpecificInt(SrcWidth - 1)))) {
----------------
RKSimon wrote:
@mayanksolanki393 m_Shr will allow you to match both lshr/ashr in a single pattern
https://github.com/llvm/llvm-project/pull/143846
More information about the llvm-commits
mailing list