[flang-commits] [flang] aaf7a0f - [flang][openacc] Add error for unsupported min/max reduction on complex type

Valentin Clement via flang-commits flang-commits at lists.llvm.org
Wed Jul 12 08:42:25 PDT 2023


Author: Valentin Clement
Date: 2023-07-12T08:42:19-07:00
New Revision: aaf7a0fa2697865718343cda22df27fb803a24d3

URL: https://github.com/llvm/llvm-project/commit/aaf7a0fa2697865718343cda22df27fb803a24d3
DIFF: https://github.com/llvm/llvm-project/commit/aaf7a0fa2697865718343cda22df27fb803a24d3.diff

LOG: [flang][openacc] Add error for unsupported min/max reduction on complex type

reduction operator min and max are not supported with complex type.
Add a proper error so it fails correctly.

Reviewed By: razvanlupusoru

Differential Revision: https://reviews.llvm.org/D155016

Added: 
    

Modified: 
    flang/lib/Lower/OpenACC.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Lower/OpenACC.cpp b/flang/lib/Lower/OpenACC.cpp
index b36d81b94114da..b7e1a23476a457 100644
--- a/flang/lib/Lower/OpenACC.cpp
+++ b/flang/lib/Lower/OpenACC.cpp
@@ -660,6 +660,9 @@ static mlir::Value genReductionInitValue(fir::FirOpBuilder &builder,
         builder.getIntegerAttr(ty, getReductionInitValue<llvm::APInt>(op, ty)));
   if (op == mlir::acc::ReductionOperator::AccMin ||
       op == mlir::acc::ReductionOperator::AccMax) {
+    if (mlir::isa<fir::ComplexType>(ty))
+      llvm::report_fatal_error(
+          "min/max reduction not supported for complex type");
     if (auto floatTy = mlir::dyn_cast_or_null<mlir::FloatType>(ty))
       return builder.create<mlir::arith::ConstantOp>(
           loc, ty,


        


More information about the flang-commits mailing list