[llvm] 887c766 - [BasicAA] Deoptimize intrinsics don't modify memory
Artur Pilipenko via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 19 12:08:46 PST 2020
Author: Artur Pilipenko
Date: 2020-11-19T12:08:33-08:00
New Revision: 887c7660bdf3f300bd1997dcfd7ace91787c0584
URL: https://github.com/llvm/llvm-project/commit/887c7660bdf3f300bd1997dcfd7ace91787c0584
DIFF: https://github.com/llvm/llvm-project/commit/887c7660bdf3f300bd1997dcfd7ace91787c0584.diff
LOG: [BasicAA] Deoptimize intrinsics don't modify memory
Similarly to assumes and guards deoptimize intrinsics are
marked as writing to ensure proper control dependencies
but they never modify any particular memory location.
Differential Revision: https://reviews.llvm.org/D91658
Added:
llvm/test/Analysis/BasicAA/deoptimize.ll
Modified:
llvm/lib/Analysis/BasicAliasAnalysis.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
index bb2c66a36cff..c2ea4f5be9f7 100644
--- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
@@ -958,6 +958,9 @@ ModRefInfo BasicAAResult::getModRefInfo(const CallBase *Call,
// the guard invokes the "deopt" continuation.
if (isIntrinsicCall(Call, Intrinsic::experimental_guard))
return ModRefInfo::Ref;
+ // The same applies to deoptimize which is essentially a guard(false).
+ if (isIntrinsicCall(Call, Intrinsic::experimental_deoptimize))
+ return ModRefInfo::Ref;
// Like assumes, invariant.start intrinsics were also marked as arbitrarily
// writing so that proper control dependencies are maintained but they never
diff --git a/llvm/test/Analysis/BasicAA/deoptimize.ll b/llvm/test/Analysis/BasicAA/deoptimize.ll
new file mode 100644
index 000000000000..927c0e03853f
--- /dev/null
+++ b/llvm/test/Analysis/BasicAA/deoptimize.ll
@@ -0,0 +1,14 @@
+; RUN: opt < %s -basic-aa -aa-eval -print-all-alias-modref-info -disable-output 2>&1 | FileCheck %s
+target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:32:64-v128:32:128-a0:0:32-n32"
+
+declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) #0
+declare void @llvm.experimental.deoptimize.void(...)
+declare void @unknown_but_readonly() readonly
+
+define void @test1(i8* %p) {
+ call void(...) @llvm.experimental.deoptimize.void() [ "deopt"() ]
+ ret void
+
+; CHECK-LABEL: Function: test1:
+; CHECK: Just Ref: Ptr: i8* %p <-> call void (...) @llvm.experimental.deoptimize.isVoid() [ "deopt"() ]
+}
More information about the llvm-commits
mailing list