Skip to content

Commit 36117bc

Browse files
authored
Merge duplicate functions from deferred codegen. (#242)
1 parent 3e1e45f commit 36117bc

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

Manifest.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ version = "1.3.0"
3939

4040
[[LLVM]]
4141
deps = ["CEnum", "LLVMExtra_jll", "Libdl", "Printf", "Unicode"]
42-
git-tree-sha1 = "23a47d417a3cd9c2e73c854bac7dd4731c105ef7"
42+
git-tree-sha1 = "29174613a9fa0424f5aef1a9dbd234acff7ce1f2"
4343
uuid = "929cbde3-209d-540e-8aea-75f648917ca0"
44-
version = "4.4.0"
44+
version = "4.5.0"
4545

4646
[[LLVMExtra_jll]]
4747
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
1414

1515
[compat]
1616
ExprTools = "0.1"
17-
LLVM = "4.4"
17+
LLVM = "4.5"
1818
TimerOutputs = "0.5"
1919
julia = "1.6"
2020

src/driver.jl

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -281,18 +281,22 @@ const __llvm_initialized = Ref(false)
281281
end
282282
end
283283

284-
# merge constants (such as exception messages) from each entry
285-
# and on platforms that support it inline and optimize the call to
286-
# the deferred code, in particular we want to remove unnecessary
287-
# alloca's that are created by pass-by-ref semantics.
288284
ModulePassManager() do pm
285+
# inline and optimize the call to the deferred code. in particular we want to
286+
# remove unnecessary alloca's that are created by pass-by-ref semantics.
289287
instruction_combining!(pm)
290-
constant_merge!(pm)
291288
always_inliner!(pm)
292289
scalar_repl_aggregates_ssa!(pm)
293290
promote_memory_to_register!(pm)
294291
gvn!(pm)
295292

293+
# merge constants (such as exception messages) from each entry
294+
constant_merge!(pm)
295+
296+
# merge duplicate functions, since each compilation invocation emits everything
297+
# XXX: ideally we want to avoid emitting these in the first place
298+
merge_functions!(pm)
299+
296300
run!(pm, ir)
297301
end
298302

0 commit comments

Comments
 (0)