How does one match undef in tablegen?

I would like to specialise build_vector for the case when one of the operands is undefined. How do I describe this?

This is looking for an analog of specialisations like:
def : Pat <v2i32 (build_vector i32:$x, (i32 0)),…>;
but for an undefined, rather than zero, value.

I can work around my ignorance in performDAGCombine but would prefer to add to the existing pattern matching.



I believe

def : Pat <v2i32 (build_vector i32:$x, (i32 undef)),…>;

Should work.

It does indeed. Somewhat embarrassed that I didn’t try that before asking.