[llvm] d95f46c - [IR] Fix incorrect writeonly on llvm.allow.ubsan/runtime.check (#145492)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 25 00:12:24 PDT 2025
Author: Nikita Popov
Date: 2025-06-25T09:12:21+02:00
New Revision: d95f46ca84d754b6368dfd256969273148c98d14
URL: https://github.com/llvm/llvm-project/commit/d95f46ca84d754b6368dfd256969273148c98d14
DIFF: https://github.com/llvm/llvm-project/commit/d95f46ca84d754b6368dfd256969273148c98d14.diff
LOG: [IR] Fix incorrect writeonly on llvm.allow.ubsan/runtime.check (#145492)
These intrinsics introduced in #84850 are currently marked as
`memory(inaccessiblemem: write)`. This is not correct for the intended
purpose of allowing per-block decisions, as such calls may get DCEd
across control-flow boundaries (which will start actually happening with
#145474).
Use `memory(inaccessiblemem: readwrite)` instead, just like all the
other control-flow sensitive intrinsics.
Added:
Modified:
llvm/include/llvm/IR/Intrinsics.td
llvm/test/Instrumentation/BoundsChecking/runtimes.ll
Removed:
################################################################################
diff --git a/llvm/include/llvm/IR/Intrinsics.td b/llvm/include/llvm/IR/Intrinsics.td
index 7add4a27ce9e9..bd6f94ac1286c 100644
--- a/llvm/include/llvm/IR/Intrinsics.td
+++ b/llvm/include/llvm/IR/Intrinsics.td
@@ -1842,11 +1842,11 @@ def int_ubsantrap : Intrinsic<[], [llvm_i8_ty],
// Return true if ubsan check is allowed.
def int_allow_ubsan_check : DefaultAttrsIntrinsic<[llvm_i1_ty], [llvm_i8_ty],
- [IntrInaccessibleMemOnly, IntrWriteMem, ImmArg<ArgIndex<0>>, NoUndef<RetIndex>]>;
+ [IntrInaccessibleMemOnly, ImmArg<ArgIndex<0>>, NoUndef<RetIndex>]>;
// Return true if runtime check is allowed.
def int_allow_runtime_check : DefaultAttrsIntrinsic<[llvm_i1_ty], [llvm_metadata_ty],
- [IntrInaccessibleMemOnly, IntrWriteMem, NoUndef<RetIndex>]>,
+ [IntrInaccessibleMemOnly, NoUndef<RetIndex>]>,
ClangBuiltin<"__builtin_allow_runtime_check">;
// Support for dynamic deoptimization (or de-specialization)
diff --git a/llvm/test/Instrumentation/BoundsChecking/runtimes.ll b/llvm/test/Instrumentation/BoundsChecking/runtimes.ll
index 6c1acf6d13775..2006a6db2ef40 100644
--- a/llvm/test/Instrumentation/BoundsChecking/runtimes.ll
+++ b/llvm/test/Instrumentation/BoundsChecking/runtimes.ll
@@ -205,7 +205,7 @@ define void @f1(i64 %x) nounwind {
; TR-GUARD: attributes #[[ATTR3]] = { nomerge noreturn nounwind }
;.
; RT-GUARD: attributes #[[ATTR0]] = { nounwind }
-; RT-GUARD: attributes #[[ATTR1:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }
+; RT-GUARD: attributes #[[ATTR1:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: readwrite) }
; RT-GUARD: attributes #[[ATTR2]] = { nomerge nounwind }
;.
; TR: [[META0]] = !{}
More information about the llvm-commits
mailing list