[PATCH] D117180: [BasicAliasAnalysis] Switch from isMallocOrCallocLikeFn to onlyAccessesInaccessibleMemory
Bryce Wilson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 13 11:45:21 PST 2022
Bryce-MW updated this revision to Diff 399743.
Bryce-MW added a comment.
- Try removing the code
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D117180/new/
https://reviews.llvm.org/D117180
Files:
llvm/lib/Analysis/BasicAliasAnalysis.cpp
llvm/test/Transforms/GVN/nonescaping-malloc.ll
Index: llvm/test/Transforms/GVN/nonescaping-malloc.ll
===================================================================
--- llvm/test/Transforms/GVN/nonescaping-malloc.ll
+++ llvm/test/Transforms/GVN/nonescaping-malloc.ll
@@ -35,7 +35,7 @@
declare i64 @strlen(i8* nocapture) nounwind readonly
-declare noalias i8* @malloc(i64) nounwind
+declare noalias i8* @malloc(i64) nounwind inaccessiblememonly
declare i32 @_ZN4llvm13StringMapImpl15LookupBucketForENS_9StringRefE(%"struct.llvm::StringMapImpl"*, i64, i64)
@@ -66,7 +66,7 @@
%tmp4.i.i = sub i32 %tmp1.i.i, %tmp3.i.i
%tmp5.i.i = add i32 %tmp4.i.i, 17
%tmp8.i.i = zext i32 %tmp5.i.i to i64
- %tmp.i20.i.i = tail call noalias i8* @malloc(i64 %tmp8.i.i) nounwind
+ %tmp.i20.i.i = tail call noalias i8* @malloc(i64 %tmp8.i.i) nounwind inaccessiblememonly
%tmp10.i.i = bitcast i8* %tmp.i20.i.i to %"struct.llvm::StringMapEntry<void*>"*
%tmp12.i.i = icmp eq i8* %tmp.i20.i.i, null
br i1 %tmp12.i.i, label %_ZN4llvm14StringMapEntryIPvE6CreateINS_15MallocAllocatorES1_EEPS2_PKcS7_RT_T0_.exit.i, label %bb.i.i
Index: llvm/lib/Analysis/BasicAliasAnalysis.cpp
===================================================================
--- llvm/lib/Analysis/BasicAliasAnalysis.cpp
+++ llvm/lib/Analysis/BasicAliasAnalysis.cpp
@@ -996,20 +996,6 @@
}
}
- // If the call is malloc/calloc like, we can assume that it doesn't
- // modify any IR visible value. This is only valid because we assume these
- // routines do not read values visible in the IR. TODO: Consider special
- // casing realloc and strdup routines which access only their arguments as
- // well. Or alternatively, replace all of this with inaccessiblememonly once
- // that's implemented fully.
- if (isMallocOrCallocLikeFn(Call, &TLI)) {
- // Be conservative if the accessed pointer may alias the allocation -
- // fallback to the generic handling below.
- if (getBestAAResults().alias(MemoryLocation::getBeforeOrAfter(Call), Loc,
- AAQI) == AliasResult::NoAlias)
- return ModRefInfo::NoModRef;
- }
-
// The semantics of memcpy intrinsics either exactly overlap or do not
// overlap, i.e., source and destination of any given memcpy are either
// no-alias or must-alias.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117180.399743.patch
Type: text/x-patch
Size: 2278 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220113/13b7c1fb/attachment.bin>
More information about the llvm-commits
mailing list