[llvm] [Loads] Support dereferenceable assumption with variable size. (PR #128436)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 4 03:21:03 PDT 2025


================
@@ -94,3 +94,50 @@ loop.end:
   %retval = phi i64 [ %index, %loop ], [ -1, %loop.inc ]
   ret i64 %retval
 }
+
+define i64 @early_exit_alignment_and_deref_known_via_assumption(ptr noalias %p1, ptr noalias %p2, i64 %n) nofree nosync {
+; CHECK-LABEL: define i64 @early_exit_alignment_and_deref_known_via_assumption(
----------------
david-arm wrote:

Looks like we bail out here:

```
  // Try to get the access size.
  const SCEV *PtrDiff = SE.getMinusSCEV(AccessEnd, AccessStart);
  if (isa<SCEVCouldNotCompute>(PtrDiff))
    return false;
```

in isDereferenceableAndAlignedInLoop

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


More information about the llvm-commits mailing list