[llvm] [VectorCombine] Add type shrinking and zext propagation for fixed-width vector types (PR #104606)

Igor Kirillov via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 2 07:15:44 PDT 2024


================
@@ -2493,6 +2494,91 @@ bool VectorCombine::foldSelectShuffle(Instruction &I, bool FromReduction) {
   return true;
 }
 
+/// Check if instruction depends on ZExt and this ZExt can be moved after the
+/// instruction. Move ZExt if it is profitable
+bool VectorCombine::shrinkType(llvm::Instruction &I) {
+  Value *ZExted, *OtherOperand;
+  if (!match(&I, m_c_BitwiseLogic(m_ZExt(m_Value(ZExted)),
+                                  m_Value(OtherOperand))) &&
----------------
igogo-x86 wrote:

If both ZExts are applied to the same type, the inst-combine will handle it. And if they are different, inst-combine will transform into the form recognised by this patch:

https://godbolt.org/z/41j8xYThP

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


More information about the llvm-commits mailing list