|
814 | 814 | function abstract_call_method_with_const_args(interp::AbstractInterpreter, |
815 | 815 | result::MethodCallResult, @nospecialize(f), arginfo::ArgInfo, si::StmtInfo, |
816 | 816 | match::MethodMatch, sv::AbsIntState, invokecall::Union{Nothing,InvokeCall}=nothing) |
817 | | - if !const_prop_enabled(interp, match, sv) || bail_out_const_call(interp, result, si, sv) |
| 817 | + if bail_out_const_call(interp, result, si, match, sv) |
818 | 818 | return nothing |
819 | 819 | end |
820 | 820 | eligibility = concrete_eval_eligible(interp, f, result, arginfo, sv) |
@@ -847,26 +847,26 @@ function abstract_call_method_with_const_args(interp::AbstractInterpreter, |
847 | 847 | return const_prop_call(interp, mi, result, arginfo, sv, concrete_eval_result) |
848 | 848 | end |
849 | 849 |
|
850 | | -function const_prop_enabled(interp::AbstractInterpreter, match::MethodMatch, sv::AbsIntState) |
| 850 | +function bail_out_const_call(interp::AbstractInterpreter, result::MethodCallResult, |
| 851 | + si::StmtInfo, match::MethodMatch, sv::AbsIntState) |
851 | 852 | if !InferenceParams(interp).ipo_constant_propagation |
852 | 853 | add_remark!(interp, sv, "[constprop] Disabled by parameter") |
853 | | - return false |
| 854 | + return true |
854 | 855 | end |
855 | 856 | if is_no_constprop(match.method) |
856 | 857 | add_remark!(interp, sv, "[constprop] Disabled by method parameter") |
857 | | - return false |
| 858 | + return true |
858 | 859 | end |
859 | | - return true |
860 | | -end |
861 | | - |
862 | | -function bail_out_const_call(interp::AbstractInterpreter, result::MethodCallResult, |
863 | | - si::StmtInfo, sv::AbsIntState) |
864 | 860 | if is_removable_if_unused(result.effects) |
865 | | - if isa(result.rt, Const) || call_result_unused(si) |
| 861 | + if isa(result.rt, Const) |
866 | 862 | add_remark!(interp, sv, "[constprop] No more information to be gained (const)") |
867 | 863 | return true |
| 864 | + elseif call_result_unused(si) |
| 865 | + add_remark!(interp, sv, "[constprop] No more information to be gained (unused result)") |
| 866 | + return true |
868 | 867 | end |
869 | | - elseif result.rt === Bottom |
| 868 | + end |
| 869 | + if result.rt === Bottom |
870 | 870 | if is_terminates(result.effects) && is_effect_free(result.effects) |
871 | 871 | # In the future, we may want to add `&& isa(result.exct, Const)` to |
872 | 872 | # the list of conditions here, but currently, our effect system isn't |
|
0 commit comments