Skip to content

Commit 25cbc66

Browse files
committed
Make VectorCombine Pass Alias Info
1 parent ca9ddd5 commit 25cbc66

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

llvm/lib/Transforms/Vectorize/VectorCombine.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1811,6 +1811,10 @@ bool VectorCombine::scalarizeLoadExtract(Instruction &I) {
18111811
// erased in the correct order.
18121812
Worklist.push(LI);
18131813

1814+
LLVMContext &ctx = LI->getContext();
1815+
unsigned aliasScopeKind = ctx.getMDKindID("alias.scope");
1816+
unsigned noAliasKind = ctx.getMDKindID("noalias");
1817+
18141818
// Replace extracts with narrow scalar loads.
18151819
for (User *U : LI->users()) {
18161820
auto *EI = cast<ExtractElementInst>(U);
@@ -1831,6 +1835,14 @@ bool VectorCombine::scalarizeLoadExtract(Instruction &I) {
18311835
LI->getAlign(), VecTy->getElementType(), Idx, *DL);
18321836
NewLoad->setAlignment(ScalarOpAlignment);
18331837

1838+
if (MDNode *aliasScope = LI->getMetadata(aliasScopeKind)) {
1839+
NewLoad->setMetadata(aliasScopeKind, aliasScope);
1840+
}
1841+
1842+
if (MDNode *noAlias = LI->getMetadata(noAliasKind)) {
1843+
NewLoad->setMetadata(noAliasKind, noAlias);
1844+
}
1845+
18341846
replaceValue(*EI, *NewLoad);
18351847
}
18361848

0 commit comments

Comments
 (0)