-
Notifications
You must be signed in to change notification settings - Fork 10.7k
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
refactor metadata propagation for consistency and completeness #30866
Comments
|
Yes, combineMetadataForCSE can be used in more places; I just didn't get around to tracking them all down. |
For background, the example I'm looking at: define i8* @isa_impl_wrap(i8** %x) { The nonnull disappears with any of these passes, and these all appear to have independent ways of optimizing the code. $ ./opt -S cse_nonnull.ll -instcombine $ ./opt -S cse_nonnull.ll -early-cse $ ./opt -S cse_nonnull.ll -mem2reg However, if the nonnull metadata appears on the 1st load only, then it survives all of these passes. |
It seems like you don't have an available load? Please note that the load you have is dead (EarlyCSE and InstCombine both look at the load and the store immediately preceding it). |
See also https://reviews.llvm.org/D27114 . |
Thanks for the link! I was looking at solving bug 31512 using an assume to attribute transform ( similar to https://reviews.llvm.org/D5951 ), but if we're looking to canonicalize in the other direction, that approach is DOA. :) |
OK, I'm starting to understand this slightly more. :) Let's look at some possible GVN tests: define i8 @nonnull1(i8** %p) { define i8 @nonnull2(i8** %p) { define i8 @nonnull3(i8** %p) { Currently, we drop the nonnull in all cases with 'opt -gvn' because MD_nonnull isn't in the list of KnownIDs.
|
For nonnull in particular, the best way to understand the semantics is probably to translate from !nonnull->assume; then the obvious redundancy rules apply. |
Please correct me if I'm misunderstanding, but if it's easier to reason about using assumes, that's another vote to reverse the current instcombine canonicalization. I like the compactness of the metadata, but given how easily it is lost, I'm seeing the advantage of the assume now. |
Sort of, yes... I mean, nonnull isn't really a property of the load; it's a property of the produced value, so attaching it to the load doesn't really make sense. But llvm.assume has a terrible design which tends to screw up other optimizations, so nobody really wants to use it. |
The BBVectorizer was removed from trunk: |
There is no reason to call combineMetadata directly with a list of MD_ nodes. The combineMetadataForCSE function handles all the metadata correctly Partially fixes: llvm#30866
…lvm#92197) There is no reason to call combineMetadata directly with a list of MD_ nodes. The combineMetadataForCSE function handles all the metadata correctly Partially fixes: llvm#30866
Extended Description
As Davide noted in the post-commit thread for r290844:
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20170102/416121.html
...we have many implementations/variations for propagating metadata in individual passes. Some of these may require different behavior, but there must be some functionality that can be shared amongst:
We have Local.cpp -> llvm::combineMetadataForCSE(). Can it be used in these cases?
The text was updated successfully, but these errors were encountered: