[llvm] [VPlan] Use SCEV to prove non-aliasing for stores at different offsets. (PR #170347)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 2 11:55:35 PST 2025


================
@@ -165,6 +205,13 @@ static bool canHoistOrSinkWithNoAliasCheck(
       if (!R.mayWriteToMemory() && !(CheckReads && R.mayReadFromMemory()))
         continue;
 
+      // For stores, check if we can use SCEV to prove no-alias.
+      if (auto *Store = dyn_cast<VPReplicateRecipe>(&R)) {
+        if (SE && L && TypeInfo && !MemOpsInGroup.empty() &&
+            isNoAliasViaDistance(Store, MemOpsInGroup[0], *SE, *L, *TypeInfo))
----------------
artagnon wrote:

Not sure I understand the logic of MemOpsInGroup[0]? Why are we checking the front, and if that's all that's checked, why don't we directly pass it? Not a fan of this API with four optional arguments that must all be checked?

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


More information about the llvm-commits mailing list