diff options
author | Anthony Ramine <[email protected]> | 2014-02-07 02:07:04 +0100 |
---|---|---|
committer | Anthony Ramine <[email protected]> | 2014-02-11 01:59:33 +0100 |
commit | 85cc321c5d3d1e78a895a549a856266228a75a02 (patch) | |
tree | 231a8cc1924b8f86b0b493088199231a749c6a2d /TAR.include | |
parent | f8723a8fe3cba291df7e087619bf4f8ee502ce52 (diff) | |
download | otp-85cc321c5d3d1e78a895a549a856266228a75a02.tar.gz otp-85cc321c5d3d1e78a895a549a856266228a75a02.tar.bz2 otp-85cc321c5d3d1e78a895a549a856266228a75a02.zip |
Optimise case arguments in sys_core_fold
If the argument of a case expression is a let, a seq or a case with two clauses
where the second one is a failing clause; it can be moved outside the case and
further optimisations can be performed.
module 'foo' ['t'/4]
attributes []
't'/4 =
fun (_cor14,Sub0,_cor15,_cor16) ->
let Ssa = call 'erlang':'get' ('foo') in
case let Ssa = {'ssa',_cor14,Sub0,_cor15,_cor16} in
let _rec11 = call 'erlang':'+' (_cor14, 1) in
let _cor4 = call 'erlang':'setelement' (2, Ssa, _rec11) in
{{'tmp',_cor14},_cor4} of
{NewReg,Foo} when 'true' ->
{NewReg,Foo,Ssa}
_cor20 when 'true' ->
primop 'match_failure' ({'case_clause',_cor20})
end
end
==>
module 'foo' ['t'/4]
attributes []
't'/4 =
fun (_cor14,Sub0,_cor15,_cor16) ->
let Ssa = call 'erlang':'get' ('foo') in
let _fol0 = {'ssa',_cor14,Sub0,_cor15,_cor16} in
let _rec11 = call 'erlang':'+' (_cor14, 1) in
let _cor4 = call 'erlang':'setelement' (2, _fol0, _rec11) in
let NewReg = {'tmp',_cor14} in
{NewReg,_cor4,Ssa}
end
Diffstat (limited to 'TAR.include')
0 files changed, 0 insertions, 0 deletions