File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
mlir/lib/Dialect/SPIRV/IR Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -345,15 +345,16 @@ struct UModSimplification final : OpRewritePattern<spirv::UModOp> {
345345 // not, fail the transformation.
346346 bool isApplicable = false ;
347347 if (auto prevInt = dyn_cast<IntegerAttr>(prevValue)) {
348- auto currInt = dyn_cast <IntegerAttr>(currValue);
348+ auto currInt = cast <IntegerAttr>(currValue);
349349 isApplicable = prevInt.getValue ().urem (currInt.getValue ()) == 0 ;
350350 } else if (auto prevVec = dyn_cast<DenseElementsAttr>(prevValue)) {
351- auto currVec = dyn_cast<DenseElementsAttr>(currValue);
352- isApplicable = llvm::all_of (
353- llvm::zip (prevVec.getValues <APInt>(), currVec.getValues <APInt>()),
354- [](const auto &pair) {
355- return std::get<0 >(pair).urem (std::get<1 >(pair)) == 0 ;
356- });
351+ auto currVec = cast<DenseElementsAttr>(currValue);
352+ isApplicable = llvm::all_of (llvm::zip_equal (prevVec.getValues <APInt>(),
353+ currVec.getValues <APInt>()),
354+ [](const auto &pair) {
355+ auto &[prev, curr] = pair;
356+ return prev.urem (curr) == 0 ;
357+ });
357358 }
358359
359360 if (!isApplicable)
You can’t perform that action at this time.
0 commit comments