[llvm] [LICM][SimplifyCFG] Ignore frees for writable dereferenceability check (PR #202589)

Antonio Frighetto via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 9 07:05:54 PDT 2026


================
@@ -2149,9 +2149,13 @@ bool llvm::promoteLoopAccessesToScalars(
   if (StoreSafety == StoreSafetyUnknown) {
     Value *Object = getUnderlyingObject(SomePtr);
     bool ExplicitlyDereferenceableOnly;
+    // The dereferenceability query here is only required to satisfy the
+    // writable contract, actual dereferenceability has already been proven
+    // above. As such, we can ignore frees.
----------------
antoniofrighetto wrote:

Might be missing something here, though where exactly is dereferenceability proven above? I think I'm slightly confused by the preceding comment "We know we can hoist the load, but don't have a guaranteed store.".

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


More information about the llvm-commits mailing list