blob: 9e0d5ecf1a32c8ebfe788f497c342504ed1454c3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
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 <vtjnash@gmail.com>
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);
}
|