aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/BasicAliasAnalysis.cpp
diff options
context:
space:
mode:
authorJoseph Tremoulet <jotrem@microsoft.com>2021-05-07 07:48:18 -0700
committerJoseph Tremoulet <jotrem@microsoft.com>2021-05-07 07:48:50 -0700
commitbc302bfbef84bd778a9e5e0a1b5851c6a55c1d9c (patch)
treeaaaa455d87bfd28defc813baf869ca89ed5cb6db /llvm/lib/Analysis/BasicAliasAnalysis.cpp
parent0a6f11aabdd3f116b603694a0d4f9abbba62ade4 (diff)
downloadllvm-bc302bfbef84bd778a9e5e0a1b5851c6a55c1d9c.zip
llvm-bc302bfbef84bd778a9e5e0a1b5851c6a55c1d9c.tar.gz
llvm-bc302bfbef84bd778a9e5e0a1b5851c6a55c1d9c.tar.bz2
BasicAA: Recognize inttoptr as isEscapeSource
Pointers escape when converted to integers, so a pointer produced by converting an integer to a pointer must not be a local non-escaping object. Reviewed By: nikic, nlopes, aqjune Differential Revision: https://reviews.llvm.org/D101541
Diffstat (limited to 'llvm/lib/Analysis/BasicAliasAnalysis.cpp')
-rw-r--r--llvm/lib/Analysis/BasicAliasAnalysis.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
index 963fb1a..dec7fcb 100644
--- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
@@ -129,6 +129,14 @@ static bool isEscapeSource(const Value *V) {
if (isa<LoadInst>(V))
return true;
+ // The inttoptr case works because isNonEscapingLocalObject considers all
+ // means of converting or equating a pointer to an int (ptrtoint, ptr store
+ // which could be followed by an integer load, ptr<->int compare) as
+ // escaping, and objects located at well-known addresses via platform-specific
+ // means cannot be considered non-escaping local objects.
+ if (isa<IntToPtrInst>(V))
+ return true;
+
return false;
}