From ae4b42f400f146f3a004b7ea324d05af13e4516a Mon Sep 17 00:00:00 2001 From: Jeff Bezanson Date: Tue, 16 Aug 2016 13:33:01 -0400 Subject: [PATCH] assume `getfield` is non-volatile if inferred to be constant fixes regression caused by #18017 --- base/inference.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/inference.jl b/base/inference.jl index 196d98705b91c..8c423674a7b99 100644 --- a/base/inference.jl +++ b/base/inference.jl @@ -2258,7 +2258,7 @@ function effect_free(e::ANY, linfo::LambdaInfo, allow_volatile::Bool) if !allow_volatile if is_known_call(e, arrayref, linfo) || is_known_call(e, arraylen, linfo) return false - elseif is_known_call(e, getfield, linfo) + elseif is_known_call(e, getfield, linfo) && !isa(exprtype(e,linfo), Const) # first argument must be immutable to ensure e is affect_free a = ea[2] typ = widenconst(exprtype(a, linfo))