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

Tarun Prabhu via flang-commits flang-commits at lists.llvm.org
Thu Oct 23 04:04:42 PDT 2025


tarunprabhu wrote:

> Does Os and Oz run with optimization level 2?

Yes. This intentionally mirrors clang's implementation. Some LLVM optimizations like [IPSCCP](https://github.com/llvm/llvm-project/blob/4f4bee428d2269808f2ef5f97f3482382d18945d/llvm/lib/Passes/PassBuilderPipelines.cpp#L1962), [inlining](https://github.com/llvm/llvm-project/blob/4f4bee428d2269808f2ef5f97f3482382d18945d/llvm/lib/Passes/PassBuilderPipelines.cpp#L808) (or [here](https://github.com/llvm/llvm-project/blob/4f4bee428d2269808f2ef5f97f3482382d18945d/llvm/lib/Passes/PassBuilderPipelines.cpp#L914)) examine this level internally, but I haven't looked at exactly how these are affected.

We could do something different in `flang` to be more aggressive, but that would be a more involved change since we may need to build flang-specific pass pipelines. We could also disable some FIR-level optimizations, but I haven't looked into that. 

Do you think that should be done as part of this PR?

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


More information about the flang-commits mailing list