Tom Eccles 66abe64466 [flang][hlfir] add an optimized bufferization pass
This pass is intended to spot cases where we can do better than the
default bufferization and to rewrite those specific cases. Then the
default bufferization (bufferize-hlfir pass) can handle everything else.

The transformation added in this patch rewrites simple element-wise
updates to an array to a do-loop modifying the array in place instead of
creating and assigning an array temporary.

See the RFC at
https://discourse.llvm.org/t/rfc-hlfir-optimized-bufferization-for-elemental-array-updates

This patch gets the improvement to exchange2 but not the improvement to cam4
described in the RFC. I think the cam4 improvement will require better alias
analysis. I aim to follow up to fix this in a later patch. With changes
since the RFC, the pass improves polyhedron channel2 by about 52%.

Depends on: D156805 D157718 D157626

Differential Revision: https://reviews.llvm.org/D157107
2023-08-18 09:51:22 +00:00

33 lines
556 B
CMake

get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
add_flang_library(HLFIRTransforms
BufferizeHLFIR.cpp
ConvertToFIR.cpp
InlineElementals.cpp
LowerHLFIRIntrinsics.cpp
LowerHLFIROrderedAssignments.cpp
ScheduleOrderedAssignments.cpp
SimplifyHLFIRIntrinsics.cpp
OptimizedBufferization.cpp
DEPENDS
FIRDialect
HLFIROpsIncGen
${dialect_libs}
LINK_LIBS
FIRAnalysis
FIRDialect
FIRBuilder
FIRDialectSupport
FIRSupport
HLFIRDialect
MLIRIR
${dialect_libs}
LINK_COMPONENTS
AsmParser
AsmPrinter
Remarks
)