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

Tarun Prabhu via flang-commits flang-commits at lists.llvm.org
Fri Nov 7 06:44:14 PST 2025


tarunprabhu wrote:

> > Several MLIR passes are now disabled if -Os or -Oz are provided.
> 
> Have you gathered any metrics on the executable size/perf impact?
 
I have not. That's a good point. I'll see what I can put together.

I don't have a use-case beyond addressing the bug-report that was filed which referenced the SPEC 2017 benchmark suite. Perhaps @ceseo, who filed that report, has more insight.

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

Do you think it would be worth splitting this into two PR's? 

The first would accept the `-Os` and `-Oz` options and defer to the pass pipeline builder to determine which LLVM IR passes to schedule. The change to `flang` would be relatively minimal since the majority of the work is already done in LLVM's PassBuilder. This would be essentially the same as `clang`. 

The second would tweak the MLIR pass pipeline, after a more careful analysis of the effects of the various passes (it may also be that we choose not to make any changes to the MLIR pass pipeline at all).

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


More information about the flang-commits mailing list