| 1 |
! Tests for the '-f[no-]save-optimization-record[=<format>]' flag. |
| 2 |
|
| 3 |
! Test opt_record flags get generated for fc1 |
| 4 |
! RUN: %flang -### %s 2>&1 \ |
| 5 |
! RUN: -foptimization-record-file=%t.opt.yaml \ |
| 6 |
! RUN: | FileCheck --check-prefix=YAML %s |
| 7 |
|
| 8 |
! RUN: %flang -### %s 2>&1 \ |
| 9 |
! RUN: -fsave-optimization-record \ |
| 10 |
! RUN: | FileCheck --check-prefix=YAML %s |
| 11 |
|
| 12 |
|
| 13 |
! Test -foptimization-record-file produces YAML file with given content |
| 14 |
! RUN: rm -f %t.opt.yaml |
| 15 |
! RUN: %flang -foptimization-record-file=%t.opt.yaml -c %s |
| 16 |
! RUN: cat %t.opt.yaml | FileCheck %s |
| 17 |
|
| 18 |
|
| 19 |
! Test -fsave-optimization-record produces YAML file with given content |
| 20 |
! RUN: rm -f %t.opt.yaml |
| 21 |
! RUN: %flang -fsave-optimization-record -c -o %t.o %s |
| 22 |
! RUN: cat %t.opt.yaml | FileCheck %s |
| 23 |
|
| 24 |
! RUN: rm -f %t.opt.yaml |
| 25 |
! RUN: %flang -fsave-optimization-record -S -o %t.s %s |
| 26 |
! RUN: cat %t.opt.yaml | FileCheck %s |
| 27 |
|
| 28 |
|
| 29 |
! Produces an empty file |
| 30 |
! RUN: rm -f %t.opt.yaml |
| 31 |
! RUN: %flang -fsave-optimization-record -S -emit-llvm -o %t.ll %s |
| 32 |
! RUN: cat %t.opt.yaml |
| 33 |
|
| 34 |
|
| 35 |
!Test unknown format produces error |
| 36 |
! RUN: not %flang -fsave-optimization-record=hello %s 2>&1 \ |
| 37 |
! RUN: | FileCheck --check-prefix=CHECK-FORMAT-ERROR %s |
| 38 |
|
| 39 |
|
| 40 |
! YAML: "-opt-record-file" "{{.+}}.opt.yaml" |
| 41 |
! YAML: "-opt-record-format" "yaml" |
| 42 |
|
| 43 |
! CHECK: --- !Analysis |
| 44 |
! CHECK: Pass: prologepilog |
| 45 |
! CHECK: Name: StackSize |
| 46 |
! CHECK: Function: _QQmain |
| 47 |
! CHECK: Pass: asm-printer |
| 48 |
! CHECK: Name: InstructionMix |
| 49 |
! CHECK: Name: InstructionCount |
| 50 |
|
| 51 |
! CHECK-FORMAT-ERROR: error: unknown remark serializer format: 'hello' |
| 52 |
|
| 53 |
program forttest |
| 54 |
implicit none |
| 55 |
integer :: n |
| 56 |
|
| 57 |
n = 1 * 1 |
| 58 |
|
| 59 |
end program forttest |