SETCC ISD node question

Should SETCC result types and input types always have the same number of vector elements or both be scalar?

I ask because it appears DAGTypeLegalizer::WidenVSELECTAndMask can create a setcc where this isn’t true.

I’ve instrumented getNode with asserts to check the types of SETCC and I’m failing on at least these tests

LLVM :: CodeGen/SystemZ/vec-cmp-cmp-logic-select.ll
LLVM :: CodeGen/SystemZ/vec-cmpsel.ll

Should SETCC result types and input types always have the same number of vector elements or both be scalar?

No. At least, the documentation for ISD::SETCC doesn't indicate it's allowed, and it's not obvious what it would mean.

I ask because it appears DAGTypeLegalizer::WidenVSELECTAndMask can create a setcc where this isn't true.

This comes from https://reviews.llvm.org/D29489 . Looking over my comments from that review, the patch isn't intentionally creating mismatched SETCCs, though.

-Eli

It seems to occur because getSETCCWidenedResultTy checks if the mask type should be widened, but then convertMask uses that VT as a result VT without doing anything to widen the inputs. Removing that code from getSETCCWidenedResultTy doesn’t regress any lit tests.

Patch to remove the code here https://reviews.llvm.org/D53743

Patch to remove the code here https://reviews.llvm.org/D53743

Not sure exactly why this is not needed anymore, but I have confirmed that benchmarks (SPEC) on SystemZ are completely unaffected by this patch. /Jonas