This is an archive of the discontinued LLVM Phabricator instance.

[flang][hlfir] Expand array hlfir.assign's.
ClosedPublic

Authored by vzakhari on Aug 30 2023, 6:13 PM.

Details

Summary

Expand hlfir.assign with in-memory array RHS and LHS into
a loop nest with element-by-element assignments.
For small arrays this may result in further loop nest unrolling
enabling more value propagation and redundancy elimination.

Note the change in flang/test/HLFIR/opt-bufferization.fir:
the hlfir.assign inside hlfir.elemental gets expanded by the new
pattern.

Depends on D159151

Diff Detail

Event Timeline

vzakhari created this revision.Aug 30 2023, 6:13 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 30 2023, 6:13 PM
vzakhari requested review of this revision.Aug 30 2023, 6:13 PM
tblah accepted this revision.Aug 31 2023, 3:02 AM

This looks good to me. Does it lead to any speedups in benchmarks? Or do we need alias analysis of fir.load to see the speedups in practice?

This revision is now accepted and ready to land.Aug 31 2023, 3:02 AM

This looks good to me. Does it lead to any speedups in benchmarks? Or do we need alias analysis of fir.load to see the speedups in practice?

This change closes the gap between FIR and HLFIR lowering for Polyhedron/fatigue2. I suppose the alias analysis for box loads might be needed for other benchmarks, but we'll see.

Thank you for the reviews!

This revision was landed with ongoing or failed builds.Aug 31 2023, 8:48 AM
This revision was automatically updated to reflect the committed changes.