Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[flang][driver] Use
-O{0|1|2|3}
to define LLVM backend pass pipeline
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. Differential Revision: https://reviews.llvm.org/D128050
- Loading branch information
1 parent
f164814
commit 48eb2bc
Showing
2 changed files
with
47 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
! Verify that`-O{n}` is indeed taken into account when definining the LLVM backend pass pipeline. | ||
|
||
! REQUIRES: aarch64-registered-target | ||
|
||
!----------- | ||
! RUN LINES | ||
!----------- | ||
! RUN: %flang_fc1 -S -O2 %s -triple aarch64-unknown-linux-gnu -mllvm -debug-pass=Structure -o /dev/null 2>&1 | FileCheck %s --check-prefix=CHECK-O2 | ||
! RUN: %flang_fc1 -S -O3 %s -triple aarch64-unknown-linux-gnu -mllvm -debug-pass=Structure -o /dev/null 2>&1 | FileCheck %s --check-prefix=CHECK-O3 | ||
|
||
!----------------------- | ||
! EXPECTED OUTPUT | ||
!----------------------- | ||
! CHECK-O2-NOT: SVE intrinsics optimizations | ||
|
||
! CHECK-O3: SVE intrinsics optimizations | ||
|
||
!------- | ||
! INPUT | ||
!------- | ||
subroutine simple_loop | ||
integer :: i | ||
do i=1,5 | ||
end do | ||
end subroutine |