-
Notifications
You must be signed in to change notification settings - Fork 0
[PowerPC][AIX] Support #pragma comment copyright for AIX #1
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
base: XCOFFAssociatedMetadata
Are you sure you want to change the base?
[PowerPC][AIX] Support #pragma comment copyright for AIX #1
Conversation
| @@ -0,0 +1,110 @@ | |||
| // REQUIRES: powerpc-registered-target, system-aix, clang | |||
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.
I don't think this test fits with the LLVM unit testing philosophy.
My understanding is that we have tests
- for the front-end generation of the
aix.copyright.commentmetadata, and - for the transformation of the
aix.copyright.commentmetadata toimplicit.ref, etc.
What we do not have are targeted tests that specifically verify that the transformation is run at the right point in the various possible pipelines.
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.
you are right. Removed this test.
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.
What we do not have are targeted tests that specifically verify that the transformation is run at the right point in the various possible pipelines.
Added the opt levels testing to llvm/test/Transforms/CopyrightMetadata/copyright-metadata.ll. Do we need an end-to-end test ?
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.
Do we need a end-to-end test ?
I can't say that we shouldn't have one. It is just that I am not aware of there being any in upstream LLVM that involve the linker (except when it's an lld test).
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.
I couldn't find anything similar as well.
438f04c to
cfa6019
Compare
252f063 to
82254ee
Compare
|
Added the test |
hubert-reinterpretcast
left a comment
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.
Some partial review comments...
| ; RUN: opt --O0 -S %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-O0 | ||
| ; RUN: opt --O1 -S %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-ON | ||
| ; RUN: opt --O2 -S %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-ON | ||
| ; RUN: opt --O3 -S %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-ON |
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.
I'm not familiar enough with how the pipelines are built between different tools (clang, opt, etc.) to know if this is the right way to check that the pass is in the pipeline at the right place (especially for LTO).
@w2yehia @mandlebug, your input would be appreciated.
| ; - Emits the string in a dedicated read-only csect | ||
| ; | ||
| ; CHECK-ASM: .ref __aix_copyright_str | ||
| ; CHECK-ASM: .csect __aix_copyright[RO],2 |
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.
Sorry for the churn. The check in llvm/test/Transforms/CopyrightMetadata/copyright-metadata.ll for constant in the IR is sufficient for establishing that we are generating as read-only, so the testing request from #1 (comment) was already satisfied (and we don't need this test just to cover that).
It is still a question whether we want to group the strings into one csect (which probably has no effect except under "full" LTO where it will increase the chance of the string being kept).
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.
ok, sure. Removing the llvm/test/CodeGen/PowerPC/pragma-comment-copyright-aix.ll.
It is still a question whether we want to group the strings into one csect (which probably has no effect except under "full" LTO where it will increase the chance of the string being kept).
Are there any downsides to the current approach ? I think it is cleaner to group them seperately in a csect.
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.
Are there any downsides to the current approach ?
It generates "false positives" to the question of whether the content associated with the copyright string was actually retained/relevant to the result.
clang/test/CodeGen/PowerPC/pragma-comment-copyright-aix-modules.cpp
Outdated
Show resolved
Hide resolved
hubert-reinterpretcast
left a comment
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 add updates to existing tests so that they continue to pass. For example, llvm/test/Other/new-pm-defaults.ll fails with:
# .---command stderr------------
# | /llvm/test/Other/new-pm-defaults.ll:241:23: error: CHECK-DEFAULT-NEXT: is not on the line after the previous match
# | ; CHECK-DEFAULT-NEXT: Running pass: EliminateAvailableExternallyPass
# | ^
# | <stdin>:100:1: note: 'next' match was here
# | Running pass: EliminateAvailableExternallyPass on [module]
# | ^
# | <stdin>:98:28: note: previous match ended here
# | Running pass: GlobalDCEPass on [module]
# | ^
# | <stdin>:99:1: note: non-matching line after previous match is here
# | Running pass: CopyrightMetadataPass on [module]
# | ^
325741a to
4d6f365
Compare
…slation unit, add backend tests
- Fix test failures: Update pipeline tests for CopyrightMetadataPass - Fixed pragma comment copyright test expectations
…s.cpp to be an llvm based test
19a0c93 to
a2904ba
Compare
|
Rebased the branch with latest updates from mandlebug:XCOFFAssociatedMetadata |
llvm/lib/Passes/PassRegistry.def
Outdated
| MODULE_PASS("constmerge", ConstantMergePass()) | ||
| MODULE_PASS("coro-cleanup", CoroCleanupPass()) | ||
| MODULE_PASS("coro-early", CoroEarlyPass()) | ||
| MODULE_PASS("copyright-metadata", CopyrightMetadataPass()) |
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.
The name of this pass should be updated too so it is independent of the word "copyright". Nothing in the IR refers to copyright. To make it easier for people to understand, the pass name should reflect the IR meta data it is processing.
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.
How about LowerCommentStringPass or LowerLoadTimeCommentPass?
| // Input IR: | ||
| // !comment_string.loadtime = !{!"Copyright"} | ||
| // Output IR: | ||
| // @__loadtime_copyright_str = internal constant [N x i8] c"Copyright\00", |
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.
Rename this to __loadtime_comment_str.
| // !comment_string.loadtime = !{!"Copyright"} | ||
| // Output IR: | ||
| // @__loadtime_copyright_str = internal constant [N x i8] c"Copyright\00", | ||
| // section "__copyright_comment" |
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.
I assume this can be renamed too. Something like __loadtime_comment
Add support for the #pragma comment (copyright, "Copyright info") directive for AIX.
This builds on top of PR #159096
Refernce: XL documentation for #pragma comment