Skip to content

Commit e82a68a

Browse files
authored
Don't rename function declarations, only definitions. (#465)
1 parent 87f0aeb commit e82a68a

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/irgen.jl

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,13 @@ function irgen(@nospecialize(job::CompilerJob); ctx::JuliaContextType)
4545
end
4646

4747
# sanitize function names
48-
# FIXME: Julia should do this, but apparently fails (see maleadt/LLVM.jl#201)
48+
# FIXME: Julia should do this, but sometimes fails (see maleadt/LLVM.jl#201)
4949
for f in functions(mod)
50-
LLVM.isintrinsic(f) && continue
50+
isdeclaration(f) && continue
5151
llvmfn = LLVM.name(f)
52-
# XXX: simplify this by only renaming definitions, not declarations?
53-
startswith(llvmfn, "julia.") && continue # Julia intrinsics
54-
startswith(llvmfn, "llvm.") && continue # unofficial LLVM intrinsics
55-
startswith(llvmfn, "air.") && continue # Metal AIR intrinsics
5652
llvmfn′ = safe_name(llvmfn)
5753
if llvmfn != llvmfn′
58-
@assert !haskey(functions(mod), llvmfn′)
54+
@assert !haskey(functions(mod), llvmfn′) "Cannot rename $llvmfn to $llvmfn′, already exists"
5955
LLVM.name!(f, llvmfn′)
6056
end
6157
end

0 commit comments

Comments
 (0)