1 ! Tests for the '-f[no-]save-optimization-record[=<format>]' flag.
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
8 ! RUN: %flang -### %s 2>&1 \
9 ! RUN: -fsave-optimization-record \
10 ! RUN: | FileCheck --check-prefix=YAML %s
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
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
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
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
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
40 ! YAML: "-opt-record-file" "{{.+}}.opt.yaml"
41 ! YAML: "-opt-record-format" "yaml"
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
51 ! CHECK-FORMAT-ERROR: error: unknown remark serializer format: 'hello'