[llvm] [VectorCombine] Preserve scoped alias metadata (PR #153714)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 15 02:34:21 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:

If possible, it would be better to use `getAAMetadata()` and `adjustForAccess()` here.

https://github.com/llvm/llvm-project/pull/153714


More information about the llvm-commits mailing list