Skip to content

Commit 20e88b5

Browse files
committed
test: add GenericMemoryRef address space regression test
Add test case for LLVM IR generation bug where stores to GenericMemoryRef incorrectly use addrspace(10) instead of addrspace(11) in bounds checking code, causing assertion failures in LLVM optimization passes. This reproduces the issue described in the gist where bounds checking generates incorrect address space casts in the LLVM IR.
1 parent aecb173 commit 20e88b5

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# This file is a part of Julia. License is MIT: https://julialang.org/license
2+
# RUN: julia --startup-file=no --check-bounds=yes %s %t -O
3+
# RUN: cat %t/* | FileCheck %s
4+
5+
include(joinpath("..", "testhelpers", "llvmpasses.jl"))
6+
7+
# Test for GenericMemoryRef address space bug
8+
# Issue: stores incorrectly use addrspace(10) instead of addrspace(11)
9+
# in bounds checking code, causing LLVM assertion failures
10+
function bf(i, x)
11+
x[i] *= x[i]
12+
nothing
13+
end
14+
15+
# CHECK-LABEL: @julia_bf
16+
# CHECK: oob:
17+
# CHECK: store {{.*}} addrspace(11) {{.*}}GenericMemoryRef
18+
# CHECK-NOT: store {{.*}} addrspace(10) {{.*}}GenericMemoryRef
19+
# CHECK: call void @ijl_bounds_error_int
20+
21+
emit(bf, Tuple{Int, Vector{Float64}})

0 commit comments

Comments
 (0)