[llvm] [InstCombine] Recognize more rotation patterns (PR #78107)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 15 04:24:12 PST 2024


================
@@ -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;
----------------
dtcxzyw wrote:

I am afraid I disagree with you. IMHO we shouldn't fall in the lie of "coverage". I've seen a bunch of useless optimizations introduced into instcombine in recent years. It makes instcombine heavy and time-consuming. 

Therefore, I am not willing to handle more patterns because it doesn't show new optimization opportunities in my benchmark https://github.com/dtcxzyw/llvm-opt-benchmark.

BTW, I plan to remove some dead code in instcombine if I have enough bandwidth :)

cc @nikic Any comments?
 

https://github.com/llvm/llvm-project/pull/78107


More information about the llvm-commits mailing list