diff options
author | John Högberg <[email protected]> | 2019-07-04 11:30:55 +0200 |
---|---|---|
committer | John Högberg <[email protected]> | 2019-07-05 15:55:56 +0200 |
commit | 39d1a52880ac90f99d5accd8df03a23fbdc05d11 (patch) | |
tree | 72e6ce74a41c0efa9503d4fa3c1e0c128100790e /.gitignore | |
parent | 8fcf04006643c70078035c9af5245e3be0c33108 (diff) | |
download | otp-39d1a52880ac90f99d5accd8df03a23fbdc05d11.tar.gz otp-39d1a52880ac90f99d5accd8df03a23fbdc05d11.tar.bz2 otp-39d1a52880ac90f99d5accd8df03a23fbdc05d11.zip |
beam_ssa_opt: Sink get_tuple_element before type optimization
Eagerly extracting elements can be quite problematic now that we
have union types. Consider the following:
0:
%% _0 is {ok, #record{}} | {error,atom()}
_1 = get_tuple_element _0, literal 0
_2 = get_tuple_element _0, literal 1
switch _1, label 0, [ { literal ok, label 1 }, { literal error, label 2 } ]
1:
%% _0 is known to be {ok,#record{}} here
2:
%% _0 is known to be {error,atom()} here
The type pass is clever enough to see that _0 has the types noted
above, but because the type of _2 is set in the first block where
we didn't have that information yet, it's still #record{} | atom()
in both branches.
Sinking these instructions to when they are used greatly improves
the type information in many cases, but it does have a few
limitations and using it in both of the above branches would take
us back to square one.
Diffstat (limited to '.gitignore')
0 files changed, 0 insertions, 0 deletions