llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.27k stars 11.68k forks source link

Gisel Combiner Limits #91559

Open tschuett opened 4 months ago

tschuett commented 4 months ago

I ran into limits on the size of patfrags:

def extract_vector_element_cast_frags : GICombinePatFrag<
  (outs root:$dst), (ins),
  !foreach(op, [G_ADDRSPACE_CAST, G_FPEXT, G_FPTOSI, G_FPTOUI, G_FPTRUNC, G_INTTOPTR,
                G_PTRTOINT, G_SEXT, G_SITOFP, G_TRUNC, G_UITOFP, G_ZEXT, G_ANYEXT],
           (pattern (G_EXTRACT_VECTOR_ELT $dst, $src, $idx), (op $src, $x)))>;

It is too large there is a lower limit.

Is there a limit on how many patterns I can register with e.g. G_EXTRACT_VECTOR_ELT as the root? My tests failed, it looked liked there were patterns that I did not register or there were suddenly wildcard patterns.

arsenm commented 4 months ago

What does hitting the limit look like? Is there an error?

tschuett commented 4 months ago

For PatFrags something like: your pattern has 25 members and the limit is ~13.

tschuett commented 4 months ago

I get strange errors with this branch as if there are unregistered patterns: https://github.com/llvm/llvm-project/compare/main...tschuett:llvm-project:gisel-extract-vector-element-cast?expand=1

llc -mtriple=aarch64 -global-isel -global-isel-abort=2 -verify-machineinstrs llvm/test/CodeGen/AArch64/extract-vector-elt.ll
tschuett commented 4 months ago

https://github.com/tschuett/llvm-project/tree/gisel-extract-vector-element-cast