Bruno Cardoso Lopes 29a000023c
[MLIR][LLVMIR] Add module flags support (#130679)
Import and translation support.

Note that existing support (prior to this PR) already covers enough in
translation specifically to emit "Debug Info Version". Also, the debug
info version metadata is being emitted even though the imported IR has
no information and is showing up in some tests (will fix that in another
PR).

---------

Co-authored-by: Tobias Gysi <tobias.gysi@nextsilicon.com>
Co-authored-by: Henrich Lauko <xlauko@mail.muni.cz>
2025-03-14 18:03:36 -07:00

26 lines
887 B
LLVM

; RUN: mlir-translate -import-llvm -split-input-file -verify-diagnostics %s | FileCheck %s
!llvm.module.flags = !{!0, !1, !2, !3, !4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{i32 7, !"frame-pointer", i32 1}
; CHECK-LABEL: module attributes {{.*}} {
; CHECK: llvm.module_flags [
; CHECK-SAME: #llvm.mlir.module_flag<error, "wchar_size", 4>,
; CHECK-SAME: #llvm.mlir.module_flag<min, "PIC Level", 2>,
; CHECK-SAME: #llvm.mlir.module_flag<max, "PIE Level", 2>,
; CHECK-SAME: #llvm.mlir.module_flag<max, "uwtable", 2>,
; CHECK-SAME: #llvm.mlir.module_flag<max, "frame-pointer", 1>]
; CHECK: }
; // -----
!llvm.module.flags = !{!0}
; expected-warning@-5{{unsupported module flag value: !"yolo_more", only constant integer currently supported}}
!0 = !{i32 1, !"yolo", !"yolo_more"}