diff options
author | Björn Gustavsson <[email protected]> | 2011-12-29 09:37:54 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2012-01-11 08:39:56 +0100 |
commit | a900b67a1f67fcd982a0aa16452b477c3ac4e264 (patch) | |
tree | e7caa05c8b93d2fed38b4f6b6d74e6da36e4b768 /lib/compiler/src | |
parent | bb312f5fb5748fef90f57ccb387f1c32a729f086 (diff) | |
download | otp-a900b67a1f67fcd982a0aa16452b477c3ac4e264.tar.gz otp-a900b67a1f67fcd982a0aa16452b477c3ac4e264.tar.bz2 otp-a900b67a1f67fcd982a0aa16452b477c3ac4e264.zip |
sys_core_fold: Remove duplicate optimization
The second clause in opt_case_in_let_2/3 attempts to do the same
optimization as opt_bool_case_redundant/1; it will never succeed.
Diffstat (limited to 'lib/compiler/src')
-rw-r--r-- | lib/compiler/src/sys_core_fold.erl | 27 |
1 files changed, 1 insertions, 26 deletions
diff --git a/lib/compiler/src/sys_core_fold.erl b/lib/compiler/src/sys_core_fold.erl index 5b155398dc..4347ec2a61 100644 --- a/lib/compiler/src/sys_core_fold.erl +++ b/lib/compiler/src/sys_core_fold.erl @@ -2065,32 +2065,7 @@ opt_case_in_let_2(V, Arg0, (_) -> false end, Es), %Only variables in tuple false = core_lib:is_var_used(V, B), %Built tuple must not be used. Arg1 = tuple_to_values(Arg0, length(Es)), %Might fail. - #c_let{vars=Es,arg=Arg1,body=B}; -opt_case_in_let_2(_, Arg, Cs) -> - %% simplify_bool_case(Case0) -> Case - %% Remove unecessary cases like - %% - %% case BoolExpr of - %% true -> true; - %% false -> false; - %% .... - %% end - %% - %% where BoolExpr is an expression that can only return true - %% or false (or throw an exception). - - true = is_bool_case(Cs) andalso is_bool_expr(Arg), - Arg. - -is_bool_case([A,B|_]) -> - (is_bool_clause(true, A) andalso is_bool_clause(false, B)) - orelse (is_bool_clause(false, A) andalso is_bool_clause(true, B)). - -is_bool_clause(Bool, #c_clause{pats=[#c_literal{val=Bool}], - guard=#c_literal{val=true}, - body=#c_literal{val=Bool}}) -> - true; -is_bool_clause(_, _) -> false. + #c_let{vars=Es,arg=Arg1,body=B}. %% is_simple_case_arg(Expr) -> true|false %% Determine whether the Expr is simple enough to be worth |