[all-commits] [llvm/llvm-project] 2f8c8c: [IR] Allocas cannot be freed (#202875)
Nikita Popov via All-commits
all-commits at lists.llvm.org
Thu Jun 11 00:12:46 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 2f8c8cb90e0a0e257689313d38bf78a0f95324b6
https://github.com/llvm/llvm-project/commit/2f8c8cb90e0a0e257689313d38bf78a0f95324b6
Author: Nikita Popov <npopov at redhat.com>
Date: 2026-06-11 (Thu, 11 Jun 2026)
Changed paths:
M llvm/lib/IR/Value.cpp
M llvm/test/Transforms/GVN/PRE/pre-loop-load.ll
Log Message:
-----------
[IR] Allocas cannot be freed (#202875)
Make canBeFreed() return false for alloca instructions. This matches the
modelling in getPointerDereferenceableBytes(), and as such only affects
the single other caller, which is loop load PRE (resolving the TODO
there).
allocas remain dereferenceable after lifetime.end, in the sense that
it's safe to speculatively load from them. They only become
non-writable, and I don't think this API is responsible for tracking
that (that would be isWritableObject, where unconditionally returning
true for allocas is technically incorrect and it already has a TODO to
that effect). To the best of my knowledge, the only transform that is
affected by lifetime.end making allocas non-writable is scalar promotion
with store speculation in LICM, so a fix to this issue will either be
localized there, or be part of a full lifetime redesign. In any case, it
should not infect the canBeFreed() API.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list