60 lines · plain
1! Tests for the '-f[no-]save-optimization-record[=<format>]' flag.2 3! Test opt_record flags get generated for fc14! RUN: %flang -### %s 2>&1 \5! RUN: -foptimization-record-file=%t.opt.yaml \6! RUN: | FileCheck --check-prefix=YAML %s7 8! RUN: %flang -### %s 2>&1 \9! RUN: -fsave-optimization-record \10! RUN: | FileCheck --check-prefix=YAML %s11 12 13! Test -foptimization-record-file produces YAML file with given content14! RUN: rm -f %t.opt.yaml15! RUN: %flang -foptimization-record-file=%t.opt.yaml -c %s16! RUN: cat %t.opt.yaml | FileCheck %s17 18 19! Test -fsave-optimization-record produces YAML file with given content20! RUN: rm -f %t.opt.yaml21! RUN: %flang -fsave-optimization-record -c -o %t.o %s22! RUN: cat %t.opt.yaml | FileCheck %s23 24! RUN: rm -f %t.opt.yaml25! RUN: %flang -fsave-optimization-record -S -o %t.s %s26! RUN: cat %t.opt.yaml | FileCheck %s27 28 29! Produces an empty file30! RUN: rm -f %t.opt.yaml31! RUN: %flang -fsave-optimization-record -S -emit-llvm -o %t.ll %s32! RUN: cat %t.opt.yaml33 34 35!Test unknown format produces error36! RUN: not %flang -fsave-optimization-record=hello %s 2>&1 \37! RUN: | FileCheck --check-prefix=CHECK-FORMAT-ERROR %s38 39 40! YAML: "-opt-record-file" "{{.+}}.opt.yaml"41! YAML: "-opt-record-format" "yaml"42 43! CHECK: --- !Analysis44! CHECK: Pass: prologepilog45! CHECK: Name: StackSize46! CHECK: Function: _QQmain47! CHECK: Pass: asm-printer48! CHECK: Name: InstructionMix49! CHECK: Name: InstructionCount50 51! CHECK-FORMAT-ERROR: error: unknown remark serializer format: 'hello'52 53program forttest54 implicit none55 integer :: n56 57 n = 1 * 158 59end program forttest60