[PATCH] D135864: [TBAA] Model call accessing immutable type as readnone
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 14 01:11:25 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG03f9d0ff2208: [TBAA] Model call accessing immutable type as readnone (authored by nikic).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D135864/new/
https://reviews.llvm.org/D135864
Files:
llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp
llvm/test/Analysis/TypeBasedAliasAnalysis/functionattrs.ll
Index: llvm/test/Analysis/TypeBasedAliasAnalysis/functionattrs.ll
===================================================================
--- llvm/test/Analysis/TypeBasedAliasAnalysis/functionattrs.ll
+++ llvm/test/Analysis/TypeBasedAliasAnalysis/functionattrs.ll
@@ -21,8 +21,8 @@
ret void
}
-; Add the readonly attribute, since there's just a call to a function which
-; TBAA says doesn't modify any memory.
+; Add the readnone attribute, since there's just a call to a function which
+; TBAA says only accesses constant memory.
; CHECK: define void @test1_yes(i32* nocapture %p) #2 {
define void @test1_yes(i32* %p) nounwind {
@@ -74,7 +74,7 @@
; CHECK: attributes #0 = { mustprogress nofree norecurse nosync nounwind readnone willreturn }
; CHECK: attributes #1 = { argmemonly mustprogress nofree norecurse nosync nounwind willreturn writeonly }
-; CHECK: attributes #2 = { nofree nounwind readonly }
+; CHECK: attributes #2 = { nofree nosync nounwind readnone }
; CHECK: attributes #3 = { nounwind }
; CHECK: attributes #4 = { mustprogress nofree nosync nounwind readnone willreturn }
; CHECK: attributes #5 = { argmemonly mustprogress nofree nosync nounwind willreturn }
Index: llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp
===================================================================
--- llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp
+++ llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp
@@ -410,12 +410,11 @@
if (!EnableTBAA)
return AAResultBase::getModRefBehavior(Call, AAQI);
- // If this is an "immutable" type, we can assume the call doesn't write
- // to memory.
+ // If this is an "immutable" type, the access is not observable.
if (const MDNode *M = Call->getMetadata(LLVMContext::MD_tbaa))
if ((!isStructPathTBAA(M) && TBAANode(M).isTypeImmutable()) ||
(isStructPathTBAA(M) && TBAAStructTagNode(M).isTypeImmutable()))
- return FunctionModRefBehavior::readOnly();
+ return FunctionModRefBehavior::none();
return AAResultBase::getModRefBehavior(Call, AAQI);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135864.467704.patch
Type: text/x-patch
Size: 2034 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221014/488e7c68/attachment.bin>
More information about the llvm-commits
mailing list