[flang-commits] [flang] [flang][Driver] Enable -Os and -Oz in flang (PR #164707)

via flang-commits flang-commits at lists.llvm.org
Fri Nov 7 05:34:34 PST 2025


jeanPerier wrote:

> Several MLIR passes are now disabled if -Os or -Oz are provided.

Have you gathered any metrics on the executable size/perf impact?

For instance, I expect that `createInlineElementals` may actually reduce code size (it is fusing loops), while I agree `createInlineHLFIRAssign` probably increases it (but not using it may cost a lot of perf).

All in all, I am a bit worried about complexifying flang pipeline (at least the MLIR pipeline) for this feature for which the use case in the community of Fortran user is a bit unclear to me.

I do expect a big impact on the code size is currently related to LLVM optimizations (inlining/loop versioning/unrolling).

More options are great on the paper, but they also means more complexity in the compiler, more technical debt/source of bugs/difficulty to reproduce issues.

If you have metrics and a use-case that justify the modification of the MLIR pipeline (say something like getting x% executable size reduction at the cost of y% slow-down on SPEC where x% and y% are what users using `Oz`/`Os` wants), I am fine with it.

https://github.com/llvm/llvm-project/pull/164707


More information about the flang-commits mailing list