[MLIR][Transform] Disambiguate ternary operator for MSVC
authorBenjamin Kramer <benny.kra@googlemail.com>
Thu, 1 Dec 2022 07:58:37 +0000 (08:58 +0100)
committerBenjamin Kramer <benny.kra@googlemail.com>
Thu, 1 Dec 2022 07:59:58 +0000 (08:59 +0100)
mlir/lib/Dialect/SCF/TransformOps/SCFTransformOps.cpp(42): error C2446: ':': no conversion from 'OpTy' to 'OpTy'
        with
        [
            OpTy=mlir::scf::ForOp
        ]
        and
        [
            OpTy=mlir::AffineForOp
        ]
mlir/lib/Dialect/SCF/TransformOps/SCFTransformOps.cpp(42): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called

mlir/lib/Dialect/SCF/TransformOps/SCFTransformOps.cpp

index ca05715..02c18c8 100644 (file)
@@ -38,9 +38,9 @@ transform::GetParentForOp::apply(transform::TransformResults &results,
   for (Operation *target : state.getPayloadOps(getTarget())) {
     Operation *loop, *current = target;
     for (unsigned i = 0, e = getNumLoops(); i < e; ++i) {
-      loop = getAffine() ? current->getParentOfType<AffineForOp>()
-                         : current->getParentOfType<scf::ForOp>();
-
+      loop = getAffine()
+                 ? current->getParentOfType<AffineForOp>().getOperation()
+                 : current->getParentOfType<scf::ForOp>().getOperation();
       if (!loop) {
         DiagnosedSilenceableFailure diag =
             emitSilenceableError()