aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/GlobalsModRef.cpp
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2022-07-21 12:10:36 +0200
committerNikita Popov <npopov@redhat.com>2022-07-21 12:39:35 +0200
commitc81dff3c306dd1a26e5f6377a040f811c325ba76 (patch)
treecfedd4f206146a3f5999c3388f47dd72727ccb93 /llvm/lib/Analysis/GlobalsModRef.cpp
parentd2a4d6bf9c52861f3d418bf7bb7d05f6e74dfead (diff)
downloadllvm-c81dff3c306dd1a26e5f6377a040f811c325ba76.zip
llvm-c81dff3c306dd1a26e5f6377a040f811c325ba76.tar.gz
llvm-c81dff3c306dd1a26e5f6377a040f811c325ba76.tar.bz2
[MemoryBuiltins] Add getFreedOperand() function (NFCI)
We currently assume in a number of places that free-like functions free their first argument. This is true for all hardcoded free-like functions, but with the new attribute-based design, the freed argument is supposed to be indicated by the allocptr attribute. To make sure we handle this correctly once allockind(free) is respected, add a getFreedOperand() helper which returns the freed argument, rather than just indicating whether the call frees *some* argument. This migrates most but not all users of isFreeCall() to the new API. The remaining users are a bit more tricky.
Diffstat (limited to 'llvm/lib/Analysis/GlobalsModRef.cpp')
-rw-r--r--llvm/lib/Analysis/GlobalsModRef.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/GlobalsModRef.cpp b/llvm/lib/Analysis/GlobalsModRef.cpp
index 563a84e..e6ef1c7 100644
--- a/llvm/lib/Analysis/GlobalsModRef.cpp
+++ b/llvm/lib/Analysis/GlobalsModRef.cpp
@@ -361,7 +361,7 @@ bool GlobalsAAResult::AnalyzeUsesOfPointer(Value *V,
if (Call->isDataOperand(&U)) {
// Detect calls to free.
if (Call->isArgOperand(&U) &&
- isFreeCall(I, &GetTLI(*Call->getFunction()))) {
+ getFreedOperand(Call, &GetTLI(*Call->getFunction())) == U) {
if (Writers)
Writers->insert(Call->getParent()->getParent());
} else {