From 6a250c4249de25784bda9223192f4ec8bc897a7b Mon Sep 17 00:00:00 2001 From: Leon Shen Date: Thu, 31 Oct 2019 12:21:14 -0400 Subject: [PATCH] Enable CFG transforms; turn DCE back on globally --- base/compiler/ssair/ir.jl | 4 ++-- test/compiler/inline.jl | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/base/compiler/ssair/ir.jl b/base/compiler/ssair/ir.jl index d34a854f8ed0c..4688a14a6fb8c 100644 --- a/base/compiler/ssair/ir.jl +++ b/base/compiler/ssair/ir.jl @@ -527,7 +527,7 @@ mutable struct IncrementalCompact cfg_transforms_enabled::Bool fold_constant_branches::Bool - function IncrementalCompact(code::IRCode, allow_cfg_transforms::Bool=false) + function IncrementalCompact(code::IRCode, allow_cfg_transforms::Bool=true) # Sort by position with attach after nodes after regular ones perm = my_sortperm(Int[let new_node = code.new_nodes.info[i] (new_node.pos * 2 + Int(new_node.attach_after)) @@ -1416,7 +1416,7 @@ function complete(compact::IncrementalCompact) return IRCode(compact.ir, compact.result, cfg, compact.new_new_nodes) end -function compact!(code::IRCode, allow_cfg_transforms::Bool=false) +function compact!(code::IRCode, allow_cfg_transforms::Bool=true) compact = IncrementalCompact(code, allow_cfg_transforms) # Just run through the iterator without any processing for _ in compact; end # _ isa Pair{Int, Any} diff --git a/test/compiler/inline.jl b/test/compiler/inline.jl index 85ac8fd6a0f4c..334bafc5c8685 100644 --- a/test/compiler/inline.jl +++ b/test/compiler/inline.jl @@ -161,7 +161,7 @@ function f_ifelse(x) return b ? x + 1 : x end # 2 for now because the compiler leaves a GotoNode around -@test_broken length(code_typed(f_ifelse, (String,))[1][1].code) <= 2 +@test length(code_typed(f_ifelse, (String,))[1][1].code) <= 2 # Test that inlining of _apply properly hits the inference cache @noinline cprop_inline_foo1() = (1, 1)