-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[flang][debug] Don't generate debug for compiler-generated variables #112423
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
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,8 @@ | ||||||
| ! RUN: %flang_fc1 -emit-llvm -debug-info-kind=standalone %s -o - | FileCheck %s | ||||||
|
|
||||||
| module m | ||||||
| integer XcX | ||||||
| end | ||||||
|
|
||||||
| ! Test that global starting with 'X' don't get filtered. | ||||||
| CHECK: !DIGlobalVariable(name: "xcx", linkageName: "_QMmExcx"{{.*}}) | ||||||
|
||||||
| CHECK: !DIGlobalVariable(name: "xcx", linkageName: "_QMmExcx"{{.*}}) | |
| ! CHECK: !DIGlobalVariable(name: "xcx", linkageName: "_QMmExcx"{{.*}}) |
Contributor
Author
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching this. Fixed.
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,14 @@ | ||
| ! RUN: %flang_fc1 -emit-llvm -debug-info-kind=standalone %s -o - | FileCheck %s | ||
|
|
||
| program test | ||
| type t1 | ||
| integer :: XcX | ||
| integer :: xdtx | ||
| end type | ||
| type(t1) :: var | ||
| var%XcX = 2 | ||
| var%xdtx = 3 | ||
| end | ||
|
|
||
| ! Test that there is no debug info for compiler generated globals. | ||
| ! CHECK-NOT: DIGlobalVariable |
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,18 @@ | ||
| // RUN: fir-opt --add-debug-info --mlir-print-debuginfo %s | FileCheck %s | ||
|
|
||
| module attributes {dlti.dl_spec = #dlti.dl_spec<>} { | ||
| fir.global linkonce_odr @_QFEXnXxcx constant target : !fir.char<1,3> { | ||
| %0 = fir.string_lit "xcx"(3) : !fir.char<1,3> | ||
| fir.has_value %0 : !fir.char<1,3> | ||
| } loc(#loc1) | ||
| fir.global linkonce_odr @_QFEXnXxdtx constant target : !fir.char<1,4> { | ||
| %0 = fir.string_lit "xdtx"(4) : !fir.char<1,4> | ||
| fir.has_value %0 : !fir.char<1,4> | ||
| } loc(#loc1) | ||
| } | ||
| #loc1 = loc("derived.f90":24:1) | ||
|
|
||
| // Test that no di_global_variable gets created for these compile generated | ||
| // globals. | ||
|
|
||
| // CHECK-NOT: #di_global_variable |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move the
result.second.name[0] == '.' || result.second.name[0] == 'X'part into somestatic fir::NameUniquer::isSpecialSymbol(llvm::StringRef name)helper inOptimizer/Support/InternalNamesso that the usages of these delimiters are better centralized and advertise.Long term, it may be better to have some compiler generated flag attributes on the global/declare for such variables (and others) rather than relying on the names.
In semantics, these variables are tagged with the
CompilerCreatedsymbol attribute, but it is currently not represented in FIR.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion. I have moved the code into a separate function.