[flang] Change return type of reduction intrinsics
authorJacob Crawley <jacob.crawley@arm.com>
Thu, 18 May 2023 15:35:36 +0000 (15:35 +0000)
committerJacob Crawley <jacob.crawley@arm.com>
Fri, 19 May 2023 14:32:06 +0000 (14:32 +0000)
commitaa9679304011170905a37758c6ce5c0c6e7a6265
tree9a4ca1f87398cd3fb09230bdd9f7708e6bdd3c7a
parent0f59bee3d58f5dc7914d58aa520e65f3ba986705
[flang] Change return type of reduction intrinsics

Comments in the recent patch https://reviews.llvm.org/D149964,
mentioned that using hlfir_ExprType in cases where intrinsics
return simple scalars adds unnecessary abstraction that isn't
needed unless an array type is being used.

This patch modifies the HLFIR operations for product, sum and any
so that they only return a hlfir_ExprType when the result is an array,
otherwise they will return just the simple scalar type.

Differential Revision: https://reviews.llvm.org/D150877
14 files changed:
flang/include/flang/Optimizer/HLFIR/HLFIROps.td
flang/lib/Lower/ConvertCall.cpp
flang/lib/Optimizer/HLFIR/IR/HLFIROps.cpp
flang/test/HLFIR/any-lowering.fir
flang/test/HLFIR/any.fir
flang/test/HLFIR/flang-experimental-hlfir-flag.f90
flang/test/HLFIR/invalid.fir
flang/test/HLFIR/product-lowering.fir
flang/test/HLFIR/product.fir
flang/test/HLFIR/sum-lowering.fir
flang/test/HLFIR/sum.fir
flang/test/Lower/HLFIR/any.f90
flang/test/Lower/HLFIR/product.f90
flang/test/Lower/HLFIR/sum.f90