[llvm] [VectorCombine] Preserve scoped alias metadata (PR #153714)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 16 01:04:28 PDT 2025
================
@@ -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);
+ }
----------------
nikic wrote:
The type is `VecTy->getElementType()`. The offset would be Idx * the type size like here: https://github.com/llvm/llvm-project/blob/adce7479712bc329a2453efc5fcdf999587b646f/llvm/lib/Transforms/Vectorize/VectorCombine.cpp#L1652-L1654
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 `dyn_cast<ConstantInt>(Idx)` case.
https://github.com/llvm/llvm-project/pull/153714
More information about the llvm-commits
mailing list