I noticed that code size optimization flags (-Os and -Oz) are not supported in Flang. Is there a plan to add these? If so, is there any ongoing work happening now?

This is the first time I’ve heard someone request or use this feature in the context of Fortran. Is there a specific use case or motivation? Is the goal to minimize total binary size or improve icache behavior?

Binary size. I hit this while building SPEC CPU 2017. I used the same config file as I would do for gcc/gfortran and saw the error.

If you open an issue, there is a chance that someone will take care of this.

Thanks, will do.

Apologies for necro-bumping this, but I put up a PR that adds support for -Os/-Oz in flang. The behavior is identical to clang, and only affects the LLVM pass pipeline. I’m happy to tweak it if there is something more specific to Fortran that would be useful.

1 Like