This is an archive of the discontinued LLVM Phabricator instance.

[mlir][LLVMIR] Use the correct way to determine if it's a scalable vector
ClosedPublic

Authored by myhsu on May 17 2022, 10:48 AM.

Details

Summary

One of the ShuffleVectorOp::build functions checks if the incoming vector operands is scalable vector by casting its type to mlir::VectorType first. However, in some cases the operand is not necessarily mlir::VectorType (e.g. it might be a LLVMVectorType) so the casting will fail.

This patch fixes this issue by using the dedicated LLVM::isScalableVectorType function to determine if the incoming vector is scalable vector or not.

NOTE: Normally we will have a pure .mlir test for this kind of changes, but the affected ShuffleVectorOp::build function is not used by the MLIR parser (but used by the translator), so I only put a translator test here.

Diff Detail

Event Timeline

myhsu created this revision.May 17 2022, 10:48 AM
Herald added a project: Restricted Project. · View Herald Transcript
myhsu requested review of this revision.May 17 2022, 10:49 AM
Mogball accepted this revision.May 17 2022, 6:04 PM
This revision is now accepted and ready to land.May 17 2022, 6:04 PM
ftynse accepted this revision.May 18 2022, 1:21 AM