Page MenuHomePhabricator

[mlir][llvm] Use tablegen to import shufflevector from LLVM IR.

Authored by gysit on Oct 13 2022, 8:12 AM.



The revision imports the shuffle vector operation using
tablegen generated builders. Additionally, it moves its test to
the instructions.ll test file.

Depends on D135874

Diff Detail

Event Timeline

gysit created this revision.Oct 13 2022, 8:12 AM
Herald added a project: Restricted Project. · View Herald Transcript
gysit requested review of this revision.Oct 13 2022, 8:12 AM
ftynse added inline comments.Oct 13 2022, 8:25 AM

Shouldn't this be $mask?

gysit added inline comments.Oct 13 2022, 9:12 AM

The shufflevector instruction has only two operands and the mask seems to be stored internally in the shufflevector instruction class. Apparently, the way to access this kind of attributes-like data is to cast the operation to its type and then use the getters:

auto *svInst = cast<llvm::ShuffleVectorInst>(inst);

Maybe I am missing something here? I use the same mechanism to access the position of the insertvalue / extractvalue operations.

ftynse accepted this revision.Oct 14 2022, 2:05 AM
ftynse added inline comments.

Sorry, I haven't noticed it was defined two lines above.

This revision is now accepted and ready to land.Oct 14 2022, 2:05 AM