[llvm] [BasicAA] Scalable offset with scalable typesize. (PR #80818)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 7 08:14:31 PST 2024


================
@@ -1170,6 +1170,26 @@ AliasResult BasicAAResult::aliasGEP(
     }
   }
 
+  // VScale Alias Analysis - Given one scalable offset between accesses and a
+  // scalable typesize, we can divide each side by vscale, treating both values
+  // as a constant. We prove that Offset/vscale >= TypeSize/vscale.
+  if (DecompGEP1.VarIndices.size() == 1 && DecompGEP1.VarIndices[0].IsNSW &&
+      DecompGEP1.Offset.isZero() &&
+      PatternMatch::match(DecompGEP1.VarIndices[0].Val.V,
+                          PatternMatch::m_VScale())) {
----------------
nikic wrote:

I think we also need `DecompGEP1.VarIndices[0].Val.TruncBits == 0`.

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


More information about the llvm-commits mailing list