This is an archive of the discontinued LLVM Phabricator instance.

Tighten description of ISD::BUILD_VECTOR
ClosedPublic

Authored by cameron.mcinally on Jul 8 2020, 10:47 AM.

Details

Summary

VerifySDNode(...) in SelectionDAG.cpp shows that the operands of a BUILD_VECTOR must all be the same type. This patch cleans up the comment in ISDOpcodes.h to make that more obvious.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptJul 8 2020, 10:47 AM
craig.topper added inline comments.Jul 8 2020, 11:01 AM
llvm/include/llvm/CodeGen/ISDOpcodes.h
452

While you're here can you drop "The number of elements is required to be a power of two." That's not true.

Remove power-of-2 requirement.

cameron.mcinally marked an inline comment as done.Jul 8 2020, 12:00 PM
This revision is now accepted and ready to land.Jul 8 2020, 12:00 PM
This revision was automatically updated to reflect the committed changes.

I'd move the "all types must be the same" to the end, so that it doesn't look like the exception overrides it, i.e. something like

The types of the operands must match the vector element type, except
that for integer types the operands are allowed to be of a larger type
than the element type, in which case the operands are implicitly
truncated. In any case, all operands must have the same type.

Thanks, @kparzysz . I like that idea. Pushed 898065a7b879f204874820f16e4e16ea2a961de0. Would you review post-commit?

Unfortunately, I missed your quoted recommendation until just now. My email client hid it. Are you okay with it as-is?