[llvm] d742493 - [BasicAA] Add support for memmove intrinsic
Evgeniy Brevnov via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 28 03:19:42 PST 2022
Author: Evgeniy Brevnov
Date: 2022-01-28T18:19:36+07:00
New Revision: d7424939a6d37caee912092ad2e644453229442f
URL: https://github.com/llvm/llvm-project/commit/d7424939a6d37caee912092ad2e644453229442f
DIFF: https://github.com/llvm/llvm-project/commit/d7424939a6d37caee912092ad2e644453229442f.diff
LOG: [BasicAA] Add support for memmove intrinsic
Currently, basic AA has special support for llvm.memcpy.* intrinsics. This change extends this support for any memory trancsfer opration and in particular llvm.memmove.* intrinsic.
Reviewed By: reames, nikic
Differential Revision: https://reviews.llvm.org/D117095
Added:
Modified:
llvm/lib/Analysis/BasicAliasAnalysis.cpp
llvm/test/Analysis/BasicAA/deoptimize.ll
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
index b4c9859628379..0a0b53796add8 100644
--- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
@@ -1010,10 +1010,13 @@ ModRefInfo BasicAAResult::getModRefInfo(const CallBase *Call,
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.
- if (auto *Inst = dyn_cast<AnyMemCpyInst>(Call)) {
+ // Ideally, there should be no need to special case for memcpy/memove
+ // intrinsics here since general machinery (based on memory attributes) should
+ // already handle it just fine. Unfortunately, it doesn't due to deficiency in
+ // operand bundles support. At the moment it's not clear if complexity behind
+ // enhancing general mechanism worths it.
+ // TODO: Consider improving operand bundles support in general mechanism.
+ if (auto *Inst = dyn_cast<AnyMemTransferInst>(Call)) {
AliasResult SrcAA =
getBestAAResults().alias(MemoryLocation::getForSource(Inst), Loc, AAQI);
AliasResult DestAA =
diff --git a/llvm/test/Analysis/BasicAA/deoptimize.ll b/llvm/test/Analysis/BasicAA/deoptimize.ll
index 18a41bd5405ae..b47b4191b144f 100644
--- a/llvm/test/Analysis/BasicAA/deoptimize.ll
+++ b/llvm/test/Analysis/BasicAA/deoptimize.ll
@@ -39,7 +39,7 @@ define i32 @test_memmove_with_deopt() {
; CHECK-LABEL: Function: test_memmove_with_deopt:
; CHECK: Just Mod: Ptr: i8* %A <-> call void @llvm.memmove.p0i8.p0i8.i64(i8* %A, i8* %B, i64 -1, i1 false) [ "deopt"() ]
; CHECK: Just Ref: Ptr: i8* %B <-> call void @llvm.memmove.p0i8.p0i8.i64(i8* %A, i8* %B, i64 -1, i1 false) [ "deopt"() ]
-; CHECK: Both ModRef: Ptr: i32* @G1 <-> call void @llvm.memmove.p0i8.p0i8.i64(i8* %A, i8* %B, i64 -1, i1 false) [ "deopt"() ]
+; CHECK: Just Ref: Ptr: i32* @G1 <-> call void @llvm.memmove.p0i8.p0i8.i64(i8* %A, i8* %B, i64 -1, i1 false) [ "deopt"() ]
%A = alloca i8
%B = alloca i8
More information about the llvm-commits
mailing list