Patch from https://github.com/JuliaLang/julia/commit/d6a655bc.patch Fix LazyArtifacts tests From d6a655bcfb610130626470e1aa5e2fc28a014b4a Mon Sep 17 00:00:00 2001 From: Jameson Nash Date: Thu, 24 Dec 2020 00:29:37 -0500 Subject: [PATCH] codegen: use new freeze intrinsics to avoid poison UB (#38977) LLVM would likely be required to insert this anyways to make hoisting legal (converting branches to and/or), so might as well add it ourselves, so that users can legally write that code directly. --- src/intrinsics.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/intrinsics.cpp b/src/intrinsics.cpp index ada6166c1ceb..b5160bbc39c0 100644 --- a/src/intrinsics.cpp +++ b/src/intrinsics.cpp @@ -542,6 +542,8 @@ static jl_cgval_t generic_cast( #endif } Value *ans = ctx.builder.CreateCast(Op, from, to); + if (f == fptosi || f == fptoui) + ans = ctx.builder.CreateFreeze(ans); return mark_julia_type(ctx, ans, false, jlto); }