[PATCH] D96031: [GlobalISel] Combine zext(trunc x) to x

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 4 06:27:48 PST 2021


foad added a comment.

Looks good but I think it needs more test coverage. Does it work on vector types? (You might need to use getScalarSizeInBits instead of getSizeInBits?) If it does work on vectors then that needs tests.



================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:2310
+  if (mi_match(SrcReg, MRI,
+               m_GTrunc(m_all_of(m_Reg(Reg), m_SpecificType(DstTy))))) {
+    return KB->getKnownBits(Reg).countMinLeadingZeros() >=
----------------
Maybe add a test case to check that this combine does nothing if the inner and outer types don't match?


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

https://reviews.llvm.org/D96031



More information about the llvm-commits mailing list