[llvm] 37d6e5b - [memoryssa] Exclude llvm.allow.{runtime,ubsan}.check() (#86066)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 31 22:50:05 PDT 2024
Author: Vitaly Buka
Date: 2024-03-31T22:50:02-07:00
New Revision: 37d6e5b7a555e8c85c3e34803a710725c26857c7
URL: https://github.com/llvm/llvm-project/commit/37d6e5b7a555e8c85c3e34803a710725c26857c7
DIFF: https://github.com/llvm/llvm-project/commit/37d6e5b7a555e8c85c3e34803a710725c26857c7.diff
LOG: [memoryssa] Exclude llvm.allow.{runtime,ubsan}.check() (#86066)
RFC:
https://discourse.llvm.org/t/rfc-add-llvm-experimental-hot-intrinsic-or-llvm-hot/77641
Added:
llvm/test/Analysis/MemorySSA/allow-check.ll
Modified:
llvm/lib/Analysis/MemorySSA.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/MemorySSA.cpp b/llvm/lib/Analysis/MemorySSA.cpp
index 82a6c470650cc9..49450d85d74225 100644
--- a/llvm/lib/Analysis/MemorySSA.cpp
+++ b/llvm/lib/Analysis/MemorySSA.cpp
@@ -292,6 +292,8 @@ instructionClobbersQuery(const MemoryDef *MD, const MemoryLocation &UseLoc,
// clobbers where they don't really exist at all. Please see D43269 for
// context.
switch (II->getIntrinsicID()) {
+ case Intrinsic::allow_runtime_check:
+ case Intrinsic::allow_ubsan_check:
case Intrinsic::invariant_start:
case Intrinsic::invariant_end:
case Intrinsic::assume:
@@ -1725,6 +1727,8 @@ MemoryUseOrDef *MemorySSA::createNewAccess(Instruction *I,
switch (II->getIntrinsicID()) {
default:
break;
+ case Intrinsic::allow_runtime_check:
+ case Intrinsic::allow_ubsan_check:
case Intrinsic::assume:
case Intrinsic::experimental_noalias_scope_decl:
case Intrinsic::pseudoprobe:
diff --git a/llvm/test/Analysis/MemorySSA/allow-check.ll b/llvm/test/Analysis/MemorySSA/allow-check.ll
new file mode 100644
index 00000000000000..dcdad001ca6f5b
--- /dev/null
+++ b/llvm/test/Analysis/MemorySSA/allow-check.ll
@@ -0,0 +1,29 @@
+; RUN: opt -aa-pipeline=basic-aa -passes='print<memoryssa>,verify<memoryssa>' -disable-output < %s 2>&1 | FileCheck %s --implicit-check-not=MemoryDef
+;
+; Ensures that allow.*.check are treated as not reading or writing memory.
+
+target triple = "aarch64-linux"
+
+define i1 @test_runtime(ptr %a) local_unnamed_addr {
+entry:
+; CHECK: 1 = MemoryDef(liveOnEntry)
+ store i32 4, ptr %a, align 4
+ %allow = call i1 @llvm.allow.runtime.check(metadata !"test_check")
+ %0 = load i32, ptr %a, align 4
+; CHECK: MemoryUse(1)
+ ret i1 %allow
+}
+
+declare i1 @llvm.allow.runtime.check(metadata)
+
+define i1 @test_ubsan(ptr %a) local_unnamed_addr {
+entry:
+; CHECK: 1 = MemoryDef(liveOnEntry)
+ store i32 4, ptr %a, align 4
+ %allow = call i1 @llvm.allow.ubsan.check(i8 7)
+ %0 = load i32, ptr %a, align 4
+; CHECK: MemoryUse(1)
+ ret i1 %allow
+}
+
+declare i1 @llvm.allow.ubsan.check(i8)
More information about the llvm-commits
mailing list