Skip to content

Commit 0bc3781

Browse files
authored
[Analysis] Exclude llvm.allow.{runtime,ubsan}.check() from AliasSetTracker (#86065)
RFC: https://discourse.llvm.org/t/rfc-add-llvm-experimental-hot-intrinsic-or-llvm-hot/77641
1 parent 1e442ac commit 0bc3781

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

llvm/lib/Analysis/AliasSetTracker.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,8 @@ void AliasSetTracker::addUnknown(Instruction *Inst) {
354354
default:
355355
break;
356356
// FIXME: Add lifetime/invariant intrinsics (See: PR30807).
357+
case Intrinsic::allow_runtime_check:
358+
case Intrinsic::allow_ubsan_check:
357359
case Intrinsic::assume:
358360
case Intrinsic::experimental_noalias_scope_decl:
359361
case Intrinsic::sideeffect:

llvm/test/Analysis/AliasSet/intrinsics.ll

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,36 @@ entry:
7474
ret void
7575
}
7676

77+
; CHECK: Alias sets for function 'test_runtime':
78+
; CHECK: Alias Set Tracker: 2 alias sets for 2 pointer values.
79+
; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod Memory locations: (ptr %a, LocationSize::precise(1))
80+
; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod Memory locations: (ptr %b, LocationSize::precise(1))
81+
define i1 @test_runtime() local_unnamed_addr {
82+
entry:
83+
%a = alloca i8, align 1
84+
%b = alloca i8, align 1
85+
store i8 1, ptr %a, align 1
86+
%allow = call i1 @llvm.allow.runtime.check(metadata !"test_check")
87+
store i8 1, ptr %b, align 1
88+
ret i1 %allow
89+
}
90+
91+
; CHECK: Alias sets for function 'test_ubsan':
92+
; CHECK: Alias Set Tracker: 2 alias sets for 2 pointer values.
93+
; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod Memory locations: (ptr %a, LocationSize::precise(1))
94+
; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod Memory locations: (ptr %b, LocationSize::precise(1))
95+
define i1 @test_ubsan() local_unnamed_addr {
96+
entry:
97+
%a = alloca i8, align 1
98+
%b = alloca i8, align 1
99+
store i8 1, ptr %a, align 1
100+
%allow = call i1 @llvm.allow.ubsan.check(i8 7)
101+
store i8 1, ptr %b, align 1
102+
ret i1 %allow
103+
}
104+
105+
declare i1 @llvm.allow.ubsan.check(i8)
106+
declare i1 @llvm.allow.runtime.check(metadata)
77107
declare void @llvm.assume(i1)
78108
declare void @llvm.experimental.guard(i1, ...)
79109
declare void @llvm.experimental.noalias.scope.decl(metadata)

0 commit comments

Comments
 (0)