[flang-commits] [flang] [flang] Avoid optimizing min and max if not valid type (PR #134972)

Tom Eccles via flang-commits flang-commits at lists.llvm.org
Wed Apr 9 02:32:03 PDT 2025


================
@@ -988,8 +988,15 @@ class ReductionConversion : public mlir::OpRewritePattern<Op> {
           op, "Currently minloc/maxloc is not handled");
     } else if constexpr (std::is_same_v<Op, hlfir::MaxvalOp> ||
                          std::is_same_v<Op, hlfir::MinvalOp>) {
+      auto ty = op.getType();
----------------
tblah wrote:

In flang we spell out the type if it isn't obvious from the context (e.g. written as part of the rhs expression)
```suggestion
      mlir::Type ty = op.getType();
```

https://github.com/llvm/llvm-project/pull/134972


More information about the flang-commits mailing list