-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[VectorCombine] Preserve scoped alias metadata #153714
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
Changes from 1 commit
25cbc66
3c3d2b8
adce747
2148978
6574cf4
9f4a0a0
8dd4467
91f0c8d
c2a88cf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -1811,6 +1811,10 @@ bool VectorCombine::scalarizeLoadExtract(Instruction &I) { | |||||||
| // erased in the correct order. | ||||||||
| Worklist.push(LI); | ||||||||
|
|
||||||||
| LLVMContext &ctx = LI->getContext(); | ||||||||
| unsigned aliasScopeKind = ctx.getMDKindID("alias.scope"); | ||||||||
| unsigned noAliasKind = ctx.getMDKindID("noalias"); | ||||||||
|
|
||||||||
| // Replace extracts with narrow scalar loads. | ||||||||
| for (User *U : LI->users()) { | ||||||||
| auto *EI = cast<ExtractElementInst>(U); | ||||||||
|
|
@@ -1831,6 +1835,14 @@ bool VectorCombine::scalarizeLoadExtract(Instruction &I) { | |||||||
| LI->getAlign(), VecTy->getElementType(), Idx, *DL); | ||||||||
| NewLoad->setAlignment(ScalarOpAlignment); | ||||||||
|
|
||||||||
| if (MDNode *aliasScope = LI->getMetadata(aliasScopeKind)) { | ||||||||
| NewLoad->setMetadata(aliasScopeKind, aliasScope); | ||||||||
| } | ||||||||
|
|
||||||||
| if (MDNode *noAlias = LI->getMetadata(noAliasKind)) { | ||||||||
| NewLoad->setMetadata(noAliasKind, noAlias); | ||||||||
| } | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If possible, it would be better to use
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @nikic, thank you for the advice. I know it's a more thoughtful solution. But I'm not familiar with AA in LLVM. Can you guide me on how to use
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The type is llvm-project/llvm/lib/Transforms/Vectorize/VectorCombine.cpp Lines 1652 to 1654 in adce747
The problem is if Idx is a variable. In that case the offset is unknown. So I would make the whole logic conditional on the |
||||||||
|
|
||||||||
| replaceValue(*EI, *NewLoad); | ||||||||
| } | ||||||||
|
|
||||||||
|
|
||||||||
Uh oh!
There was an error while loading. Please reload this page.