
Fir.GlobalOp's currently do not respect attributes that are applied to them, this change will do two things: - Allow lowering of arbitrary attributes applied to Fir.GlobalOp's to LLVMGlobalOp's during CodeGen - Allow printing and parsing of arbitrarily applied attributes This allows applying other dialects attributes (or other fir attributes) to fir.GlobalOps on the fly and have them exist in the resulting LLVM dialect IR or FIR IR. Reviewer: jeanPerier Differential Revision: https://reviews.llvm.org/D148352
18 lines
792 B
Plaintext
18 lines
792 B
Plaintext
// RUN: fir-opt --fir-to-llvm-ir %s | FileCheck %s
|
|
// RUN: tco --fir-to-llvm-ir %s | FileCheck %s
|
|
// RUN: fir-opt %s | FileCheck %s --check-prefix=READ-OUT
|
|
// RUN: tco --emit-fir %s | FileCheck %s --check-prefix=READ-OUT
|
|
|
|
// CHECK: llvm.mlir.global external @_QMtest_0Edata_int() {{{.*}}test = "string_attribute_maintained"{{.*}}} : i32 {
|
|
// CHECK: [[CST0:%.*]] = llvm.mlir.constant(10 : i32) : i32
|
|
// CHECK: llvm.return [[CST0]] : i32
|
|
// CHECK: }
|
|
// READ-OUT: fir.global @_QMtest_0Edata_int {test = "string_attribute_maintained"} : i32 {
|
|
// READ-OUT: %c10_i32 = arith.constant 10 : i32
|
|
// READ-OUT: fir.has_value %c10_i32 : i32
|
|
// READ-OUT: }
|
|
fir.global @_QMtest_0Edata_int {test = "string_attribute_maintained"} : i32 {
|
|
%c10_i32 = arith.constant 10 : i32
|
|
fir.has_value %c10_i32 : i32
|
|
}
|