diff --git a/Project.toml b/Project.toml index 6f97efc9..d1c314c0 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "GPUCompiler" uuid = "61eb1bfa-7361-4325-ad38-22787b887f55" authors = ["Tim Besard "] -version = "0.27.3" +version = "0.27.4" [deps] ExprTools = "e2ba6199-217a-4e67-a87a-7c52f15ade04" diff --git a/src/metal.jl b/src/metal.jl index 213898b1..87d2106e 100644 --- a/src/metal.jl +++ b/src/metal.jl @@ -134,13 +134,6 @@ function finish_ir!(@nospecialize(job::CompilerJob{MetalCompilerTarget}), mod::L entry::LLVM.Function) entry_fn = LLVM.name(entry) - # get rid of unreachable control flow (JuliaLang/Metal.jl#370) - if job.config.target.macos < v"15" - for f in functions(mod) - replace_unreachable!(job, f) - end - end - # add kernel metadata if job.config.kernel entry = add_address_spaces!(job, mod, entry) @@ -148,9 +141,18 @@ function finish_ir!(@nospecialize(job::CompilerJob{MetalCompilerTarget}), mod::L add_argument_metadata!(job, mod, entry) add_module_metadata!(job, mod) + end + + # JuliaLang/Metal.jl#113 + hide_noreturn!(mod) - # JuliaLang/Metal.jl#113 - hide_noreturn!(mod) + # get rid of unreachable control flow (JuliaLang/Metal.jl#370). + # note that this currently works in tandem with the `hide_noreturn!` pass above, + # as `replace_unreachable!` doesn't handle functions that _only_ contain `unreachable`. + if job.config.target.macos < v"15" + for f in functions(mod) + replace_unreachable!(job, f) + end end # lower LLVM intrinsics that AIR doesn't support