This relatively small change will allow Flang's frontend driver, `flang-new -fc1`, to consume and parse MLIR files. Semantically (i.e. from user's perspective) this is identical to reading LLVM IR files. Two file extensions are associated with MLIR files: .fir and .mlir. Note that reading MLIR files makes only sense when running one of the code-generation actions, i.e. when using one of the following action flags: -S, -emit-obj, -emit-llvm, -emit-llvm-bc. The majority of tests that required `tco` to run are updated to also run with `flang-new -fc1`. A few tests are updated to use `fir-opt` instead of `tco` (that's the preferred choice when testing a particular MLIR pass). basic-program.fir is not updated as that test is intended to verify the behaviour of `tco` specifically. Differential Revision: https://reviews.llvm.org/D126890
22 lines
670 B
LLVM
22 lines
670 B
LLVM
; This file is a valid LLVM IR file, but we force the driver to treat it as
|
|
; FIR (with the `-x` flag). This way we verify that the driver
|
|
; correctly rejects invalid FIR input.
|
|
|
|
;----------
|
|
; RUN LINES
|
|
;----------
|
|
; Input type is implicit (correctly assumed to be LLVM IR)
|
|
; RUN: %flang_fc1 -S %s -o -
|
|
|
|
; Input type is explicitly set as FIR
|
|
; Verify that parsing errors are correctly reported by the driver
|
|
; RUN: not %flang_fc1 -S -x fir %s 2>&1 | FileCheck %s --check-prefix=ERROR
|
|
; RUN: not %flang_fc1 -S %s -x mlir 2>&1 | FileCheck %s --check-prefix=ERROR
|
|
|
|
; ERROR: error: unexpected character
|
|
; ERROR: error: Could not parse FIR
|
|
|
|
define void @foo() {
|
|
ret void
|
|
}
|