@@ -61,53 +61,41 @@ function substitute_broadcast(
6161 configarg = (inline, u₁, u₂, v, true , threads, warncheckarg, safe)
6262 unroll_param_tup =
6363 Expr (:call , lv (:avx_config_val ), :(Val {$configarg} ()), staticexpr (0 ))
64+
6465 for n ∈ 1 : nargs
6566 _ciₙ = ci[n]
66- if _ciₙ isa Symbol
67- syms[n] = _ciₙ:: Symbol
68- else
69- syms[n] = Symbol (' %' , n)
70- # ciₙ::Expr = _ciₙ::Expr
71- if _ciₙ isa Expr
72- ciₙ = _ciₙ
73- elseif _ciₙ isa GlobalRef
74- ciₙ = Expr (:globalref , _ciₙ. mod, _ciₙ. name)
67+ syms[n] = Symbol (' %' , n)
68+
69+ if _ciₙ isa Core. SSAValue
70+ push! (lb. args, Expr (:(= ), syms[n], syms[_ciₙ. id]))
71+
72+ elseif _ciₙ isa GlobalRef
73+ if _ciₙ. mod === Base || _ciₙ. mod === Core
74+ push! (lb. args, Expr (:(= ), syms[n], lv (_ciₙ. name)))
7575 else
76- error ( " Unexpected type in ci: $( typeof ( _ciₙ)) " )
76+ push! (lb . args, Expr (:( = ), syms[n], _ciₙ. name) )
7777 end
78- ciₙargs = ciₙ. args
79- f = first (ciₙargs)
80- if ciₙ. head === :(= )
81- push! (lb. args, Expr (:(= ), f, syms[((ciₙargs[2 ]):: Core.SSAValue ). id]))
82- elseif isglobalref (f, Base, :materialize! )
83- add_ci_call! (
84- lb,
85- lv (:vmaterialize! ),
86- ciₙargs,
87- syms,
88- n,
89- unroll_param_tup,
90- mod
91- )
78+
79+ elseif _ciₙ isa Expr && _ciₙ. head === :call
80+ f = first (_ciₙ. args)
81+ if isglobalref (f, Base, :materialize! )
82+ add_ci_call! (lb, lv (:vmaterialize! ), _ciₙ. args, syms, n, unroll_param_tup, mod)
9283 elseif isglobalref (f, Base, :materialize )
93- add_ci_call! (
94- lb,
95- lv (:vmaterialize ),
96- ciₙargs,
97- syms,
98- n,
99- unroll_param_tup,
100- mod
101- )
84+ add_ci_call! (lb, lv (:vmaterialize ), _ciₙ. args, syms, n, unroll_param_tup, mod)
10285 else
103- add_ci_call! (lb, f, ciₙargs , syms, n)
86+ add_ci_call! (lb, f, _ciₙ . args , syms, n)
10487 end
88+
89+ else
90+ push! (lb. args, Expr (:(= ), syms[n], _ciₙ))
10591 end
10692 end
93+
10794 ret:: Expr = pop! (lb. args):: Expr
10895 if Meta. isexpr (ret, :(= ), 2 )
10996 ret = (ret. args[2 ]):: Expr
11097 end
98+
11199 esc (Expr (:let , lb, Expr (:block , ret)))
112100end
113101
0 commit comments