This is an archive of the discontinued LLVM Phabricator instance.

[flang] Change return type of reduction intrinsics
ClosedPublic

Authored by jacob-crawley on May 18 2023, 9:05 AM.

Details

Summary

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.

Diff Detail

Event Timeline

jacob-crawley created this revision.May 18 2023, 9:05 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMay 18 2023, 9:05 AM
jacob-crawley requested review of this revision.May 18 2023, 9:05 AM
jeanPerier accepted this revision.May 19 2023, 1:23 AM

Thanks!

flang/lib/Optimizer/HLFIR/IR/HLFIROps.cpp
471

"&& dim != std::nullptr" is more idiomatic.

594

same here.

This revision is now accepted and ready to land.May 19 2023, 1:23 AM

Thanks for the review.

Nit changes to use std::nullptr instead of NULL

jacob-crawley marked 2 inline comments as done.May 19 2023, 3:24 AM
tblah accepted this revision.May 19 2023, 5:35 AM

Great work on this

This revision was automatically updated to reflect the committed changes.