[RFC][flang] Expanding array expressions and assignments at O0

I previously argued against inlining array assignments/expressions at O0, mostly because the expansion diminished the ability to set breakpoint on such statements, and because the runtime implementations have conformity/allocation status checks that are valuable when debugging and that the expanded version do not have.

The first issue has been solved by this FastIsel change and this FIR canonicalization change, and I have a design doc for inline runtime checks for review.

So I would like to now propose inlining array assignments, expressions, and transformationals at O0 (in practice to remove all the O0 exceptions in createHLFIRToFIRPassPipeline).

The motivation is that using the runtime forces the materialization of array expressions in potentially huge temporaries (for instance, a+b must be materialized in order to call FortranAssign for x = a+b). No other compiler (IFX, gfortran, NV) is doing that at O0, and the performance hit, even on CPU code, of such temporaries can lead to huge slowdowns at O0 that makes app debugging much slower).

1 Like