-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[MLIR][LLVMIR] Add module flags support #130679
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
bcardosolopes
merged 18 commits into
llvm:main
from
bcardosolopes:mlir-llvm-module-flags
Mar 15, 2025
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
3a692db
[MLIR][LLVMIR] Add module flags support
bcardosolopes 2ae67c7
Attempt to get windows bot happy
bcardosolopes 478d3ed
More attempts to massage filecheck
bcardosolopes 216e480
Update mlir/include/mlir/Target/LLVMIR/ModuleImport.h
bcardosolopes d42630c
Update mlir/lib/Target/LLVMIR/Dialect/LLVMIR/LLVMToLLVMIRTranslation.cpp
bcardosolopes 2ccacdc
Update mlir/include/mlir/Dialect/LLVMIR/LLVMAttrDefs.td
bcardosolopes eb04bec
Update mlir/include/mlir/Dialect/LLVMIR/LLVMAttrDefs.td
bcardosolopes f1e4de8
Update mlir/lib/Target/LLVMIR/Dialect/LLVMIR/LLVMToLLVMIRTranslation.cpp
bcardosolopes e9565c6
Update mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
bcardosolopes bef17f7
Update mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
bcardosolopes 0a791e7
Update mlir/lib/Target/LLVMIR/ModuleImport.cpp
bcardosolopes 02b854d
Fix several review issues
bcardosolopes 62c1e43
Improve tablegen docs
bcardosolopes 2665e61
Use convertModFlagBehaviorFromLLVM
bcardosolopes ddb49f9
Use convertModFlagBehaviorToLLVM
bcardosolopes 3f347a7
Update more comments
bcardosolopes 708cda8
Procude as much warnings as possible
bcardosolopes 220fa4a
Address review
bcardosolopes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| // RUN: mlir-opt %s | mlir-opt | FileCheck %s | ||
|
|
||
| module { | ||
| llvm.module_flags [#llvm.mlir.module_flag<error, "wchar_size", 4>, | ||
| #llvm.mlir.module_flag<min, "PIC Level", 2>, | ||
| #llvm.mlir.module_flag<max, "PIE Level", 2>, | ||
| #llvm.mlir.module_flag<max, "uwtable", 2>, | ||
| #llvm.mlir.module_flag<max, "frame-pointer", 1>] | ||
| } | ||
|
|
||
| // 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>] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| ; 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"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.