@@ -1586,26 +1586,25 @@ OpFoldResult cir::VecExtractOp::fold(FoldAdaptor adaptor) {
15861586LogicalResult cir::VecShuffleOp::verify () {
15871587 // The number of elements in the indices array must match the number of
15881588 // elements in the result type.
1589- if (getIndices ().size () != getResult ().getType ().getSize ()) {
1589+ if (getIndices ().size () != getResult ().getType ().getSize ())
15901590 return emitOpError () << " : the number of elements in " << getIndices ()
15911591 << " and " << getResult ().getType () << " don't match" ;
1592- }
15931592
15941593 // The element types of the two input vectors and of the result type must
15951594 // match.
15961595 if (getVec1 ().getType ().getElementType () !=
1597- getResult ().getType ().getElementType ()) {
1596+ getResult ().getType ().getElementType ())
15981597 return emitOpError () << " : element types of " << getVec1 ().getType ()
15991598 << " and " << getResult ().getType () << " don't match" ;
1600- }
16011599
16021600 const uint64_t maxValidIndex =
16031601 getVec1 ().getType ().getSize () + getVec2 ().getType ().getSize () - 1 ;
1604- for (const auto &idxAttr : getIndices ().getAsRange <cir::IntAttr>()) {
1605- if (idxAttr.getSInt () != -1 && idxAttr.getUInt () > maxValidIndex)
1606- return emitOpError () << " : index for __builtin_shufflevector must be "
1607- " less than the total number of vector elements" ;
1608- }
1602+ if (llvm::any_of (
1603+ getIndices ().getAsRange <cir::IntAttr>(), [&](cir::IntAttr idxAttr) {
1604+ return idxAttr.getSInt () != -1 && idxAttr.getUInt () > maxValidIndex;
1605+ }))
1606+ return emitOpError () << " : index for __builtin_shufflevector must be "
1607+ " less than the total number of vector elements" ;
16091608
16101609 return success ();
16111610}
0 commit comments