[PATCH] D99135: [deref] Implement initial set of inference rules for deref-at-point
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 24 15:22:12 PDT 2021
nikic added inline comments.
================
Comment at: llvm/lib/IR/Value.cpp:741
+ // *) An alloca is deallocated when the function returns
+ if (isa<GlobalValue>(V) || isa<Constant>(V) || isa<AllocaInst>(V))
+ return false;
----------------
GlobalValue is a subtype of Constant, no need to check it separately.
================
Comment at: llvm/lib/IR/Value.cpp:746
+ // An argument to a function which neither frees, nor can arrange
+ // for another thread to free on it's behalf, can not be freed in it's
+ // defined scope.
----------------
nit: it's -> its
================
Comment at: llvm/lib/IR/Value.cpp:750
+ if (F->doesNotFreeMemory() && F->hasNoSync())
+ return false;
+ }
----------------
I don't really get why this code is specific to arguments. Shouldn't this hold for any SSA value inside the function? Sure, it can get freed after the function returns/unwinds, but not while the SSA value is active. Am I missing something here?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D99135/new/
https://reviews.llvm.org/D99135
More information about the llvm-commits
mailing list