[PATCH] D126617: [InstCombine] Optimize shl+lshr+and conversion pattern

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 31 11:54:25 PDT 2022


spatel added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:1892-1894
+    if (C->isPowerOf2() &&
+        match(Op0,
+              m_OneUse(m_LShr(m_Shl(m_APInt(C1), m_Value(X)), m_APInt(C2)))) &&
----------------
What happens if we reduce the pattern to:
https://alive2.llvm.org/ce/z/7snGRd

That's the same transform that I suggested in D126591, but invert the shift direction (lshr instead of shl).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126617/new/

https://reviews.llvm.org/D126617



More information about the llvm-commits mailing list