This is an archive of the discontinued LLVM Phabricator instance.

[flang][driver] Use `-O{0|1|2|3}` to define LLVM backend pass pipeline
ClosedPublic

Authored by awarzynski on Jun 17 2022, 6:26 AM.

Details

Summary

Support for optimisation flags in LLVM Flang was originally added in
https://reviews.llvm.org/D128043. That patch focused on LLVM
middle-end/optimisation pipelines. With this patch, Flang will
additionally configure LLVM backend pass pipelines accordingly. This
behavior is consistent with Clang.

New hook is added to translate compiler optimisation flags (e.g. -O3)
into backend optimisation level: getCGOptLevel. Identical hooks are
available in Clang and LLVM. In other words, the meaning of these
optimisation flags remains consistent with other sub-projects that use
LLVM backends.

Depends on D128043

Diff Detail

Event Timeline

awarzynski created this revision.Jun 17 2022, 6:26 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald Transcript
awarzynski requested review of this revision.Jun 17 2022, 6:26 AM
rovka accepted this revision.Jun 21 2022, 5:46 AM

Seems fine, thanks.

flang/lib/Frontend/FrontendActions.cpp
554–559
555
flang/test/Driver/default-backend-pipelines.f90
2
This revision is now accepted and ready to land.Jun 21 2022, 5:46 AM

Rebase + address Diana's comments

This revision was landed with ongoing or failed builds.Jun 27 2022, 8:09 AM
This revision was automatically updated to reflect the committed changes.