Skip to content

Commit a6e6d0a

Browse files
authored
Don't have LLVM clone metadata when cloning functions. (#285)
1 parent d124e80 commit a6e6d0a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/irgen.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -600,9 +600,10 @@ function add_kernel_state!(@nospecialize(job::CompilerJob), mod::LLVM.Module,
600600
return val
601601
end
602602

603-
# NOTE: we need global changes because LLVM 12 wants to clone debug metadata
603+
# we don't want module-level changes, because otherwise LLVM will clone metadata,
604+
# resulting in mismatching references between `!dbg` metadata and `dbg` instructions
604605
clone_into!(new_f, f; value_map, materializer,
605-
changes=LLVM.API.LLVMCloneFunctionChangeTypeGlobalChanges)
606+
changes=LLVM.API.LLVMCloneFunctionChangeTypeLocalChangesOnly)
606607

607608
# we can't remove this function yet, as we might still need to rewrite any called,
608609
# but remove the IR already

0 commit comments

Comments
 (0)