[PATCH] D77210: [GlobalISel] Combine sext([sz]ext) -> [sz]ext, zext(zext) -> zext

Dominik Montada via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 2 03:13:51 PDT 2020


gargaroff marked an inline comment as done.
gargaroff added inline comments.


================
Comment at: llvm/include/llvm/CodeGen/GlobalISel/LegalizationArtifactCombiner.h:180
+    if (mi_match(SrcReg, MRI,
+                 m_all_of(m_MInstr(ExtMI), m_any_of(m_GZExt(m_Reg(ExtSrc)),
+                                                    m_GSExt(m_Reg(ExtSrc)))))) {
----------------
arsenm wrote:
> Why the m_all_of?
This is needed to get the matched extension instruction. I didn't find any other way to easily get the instruction. Using it in place of `m_Reg` gives me the def of `ExtSrc` and I'm not aware of any matcher which give you the *matched* instruction. That's why I use `m_all_of`. This pattern is also used in `tryCombineAnyExt`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77210





More information about the llvm-commits mailing list