Mercurial > hg > CbC > CbC_llvm
comparison flang/test/Driver/save-mlir-temps.f90 @ 252:1f2b6ac9f198 llvm-original
LLVM16-1
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 18 Aug 2023 09:04:13 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
237:c80f45b162ad | 252:1f2b6ac9f198 |
---|---|
1 ! Tests for the `-save-temps` flag. Instead of checking the commands generated | |
2 ! by the driver with `-###` (like the save-temps.f90 test does), here we check | |
3 ! that the MLIR files are actually produced in the specified location because | |
4 ! the driver does not generate specific passes for MLIR. Instead, they are | |
5 ! generated during code generation as additional outputs. | |
6 | |
7 ! As `flang` does not implement `-fc1as` (i.e. a driver for the integrated | |
8 ! assembler), we need to use `-fno-integrated-as` here. | |
9 | |
10 ! UNSUPPORTED: system-windows | |
11 | |
12 !-------------------------- | |
13 ! Invalid output directory | |
14 !-------------------------- | |
15 ! RUN: not %flang_fc1 -emit-llvm-bc -save-temps=#invalid-dir -o - %s 2>&1 | FileCheck %s -check-prefix=MLIR-ERROR | |
16 ! MLIR-ERROR: error: Saving MLIR temp file failed | |
17 | |
18 !-------------------------- | |
19 ! Save to cwd | |
20 !-------------------------- | |
21 ! RUN: rm -rf %t && mkdir -p %t | |
22 ! RUN: pushd %t && %flang -c -fno-integrated-as -save-temps=cwd -o out.o %s 2>&1 | |
23 ! RUN: FileCheck %s -input-file=save-mlir-temps-fir.mlir -check-prefix=MLIR-FIR | |
24 ! RUN: FileCheck %s -input-file=save-mlir-temps-llvmir.mlir -check-prefix=MLIR-LLVMIR | |
25 ! RUN: popd | |
26 | |
27 ! RUN: rm -rf %t && mkdir -p %t | |
28 ! RUN: pushd %t && %flang -c -fno-integrated-as -save-temps -o out.o %s 2>&1 | |
29 ! RUN: FileCheck %s -input-file=save-mlir-temps-fir.mlir -check-prefix=MLIR-FIR | |
30 ! RUN: FileCheck %s -input-file=save-mlir-temps-llvmir.mlir -check-prefix=MLIR-LLVMIR | |
31 ! RUN: popd | |
32 | |
33 !-------------------------- | |
34 ! Save to output directory | |
35 !-------------------------- | |
36 ! RUN: rm -rf %t && mkdir -p %t | |
37 ! RUN: %flang -c -fno-integrated-as -save-temps=obj -o %t/out.o %s 2>&1 | |
38 ! RUN: FileCheck %s -input-file=%t/save-mlir-temps-fir.mlir -check-prefix=MLIR-FIR | |
39 ! RUN: FileCheck %s -input-file=%t/save-mlir-temps-llvmir.mlir -check-prefix=MLIR-LLVMIR | |
40 | |
41 !-------------------------- | |
42 ! Save to specific directory | |
43 !-------------------------- | |
44 ! RUN: rm -rf %t && mkdir -p %t | |
45 ! RUN: %flang -c -fno-integrated-as -save-temps=%t -o %t/out.o %s 2>&1 | |
46 ! RUN: FileCheck %s -input-file=%t/save-mlir-temps-fir.mlir -check-prefix=MLIR-FIR | |
47 ! RUN: FileCheck %s -input-file=%t/save-mlir-temps-llvmir.mlir -check-prefix=MLIR-LLVMIR | |
48 | |
49 !-------------------------- | |
50 ! Content to check from the MLIR outputs | |
51 !-------------------------- | |
52 ! MLIR-FIR-NOT: llvm.func | |
53 ! MLIR-FIR: func.func @{{.*}}main() { | |
54 | |
55 ! MLIR-FIR-NOT: func.func | |
56 ! MLIR-LLVMIR: llvm.func @{{.*}}main() { | |
57 | |
58 end program |