From: Evgeniy Brevnov Date: Mon, 24 Jan 2022 09:49:08 +0000 (+0700) Subject: [BasicAA] Add support for memmove intrinsic X-Git-Tag: upstream/15.0.7~18725 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d7424939a6d37caee912092ad2e644453229442f;p=platform%2Fupstream%2Fllvm.git [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 --- diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp index b4c9859..0a0b537 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(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(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 18a41bd..b47b419 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