aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-range.h
AgeCommit message (Collapse)AuthorFilesLines
2021-09-13Merged current trunk to branch.Thomas Koenig1-137/+20
2020-11-13Re: Fix gimple_expr_code?Andrew MacLeod1-6/+6
have gimple_expr_code return the correct code for GIMPLE_ASSIGN. use gassign and gcond in gimple_range_handler. * gimple-range.h (gimple_range_handler): Cast to gimple stmt kinds before asking for code and type. * gimple.h (gimple_expr_code): Call gassign and gcond routines to get their expr_code.
2020-11-13Cleanup range of address calculations.Andrew MacLeod1-1/+1
Align EVRP and ranger for how ranges of ADDR_EXPR are calculated. gcc/ * gimple-range.cc: (gimple_ranger::range_of_range_op): Check for ADDR_EXPR and call range_of_address. (gimple_ranger::range_of_address): Rename from range_of_non_trivial_assignment and match vrp_stmt_computes_nonzero. * gimple-range.h: (range_of_address): Renamed. * range-op.cc: (pointer_table): Add INTEGER_CST handler. gcc/testsuite/ * gcc.dg/tree-ssa/pr78655.c: New.
2020-11-12Change range_handler, was Re: Fix gimple_expr_code?Andrew MacLeod1-2/+6
Adjust the range_handler to not use gimple_expr_code/type. * gimple-range.h (gimple_range_handler): Use gimple_assign and gimple_cond routines to get type and code. * range-op.cc (range_op_handler): Check for integral types.
2020-10-20Refactor range handling of builtins in vr_values and ranger.Aldy Hernandez1-1/+3
This sets things up so we can share range handling of builtins between vr_values and ranger. It is meant to refactor the code so that we can verify that both implementations yield the same results. First, we abstract out gimple_ranger::range_of_builtin_call into an externally visible counterpart that can be called from vr_values. It will take a range_query since both ranger and vr_values inherit from this base class. Then we abstract out all the builtin handling in vr_values into a separate method that is easier to compare against. Finally, we call the ranger version from vr_values and compare it with the vr_values version. Since this proves both versions return the same, we can remove vr_values::extract_range_builtin in a follow-up patch. The vr_values::range_of_expr change brings the vr_values version up to par with the ranger version. It should've handled non-SSA's. This was a small oversight that went unnoticed because the vr_value version isn't stressed nearly as much as the ranger version. The change is needed because the ranger code handling builtins calls, may call it for integer arguments in range_of_builtin_ubsan_call. There should be no change in functionality. gcc/ChangeLog: * gimple-range.cc (gimple_ranger::range_of_builtin_ubsan_call): Make externally visble... (range_of_builtin_ubsan_call): ...here. Add range_query argument. (gimple_ranger::range_of_builtin_call): Make externally visible... (range_of_builtin_call): ...here. Add range_query argument. * gimple-range.h (range_of_builtin_call): Move out from class and make externally visible. * vr-values.c (vr_values::extract_range_basic): Abstract out builtin handling to... (vr_values::range_of_expr): Handle non SSAs. (vr_values::extract_range_builtin): ...here. * vr-values.h (class vr_values): Add extract_range_builtin. (range_of_expr): Rename NAME to EXPR.
2020-10-19Use precision and sign to compare types for rangesAndrew MacLeod1-0/+12
Sanity check ranges by comparing just SIGN and PRECISION. gcc/ PR tree-optimization/97360 * gimple-range.h (range_compatible_p): New. * gimple-range-gori.cc (is_gimple_logical_p): Use range_compatible_p. (range_is_either_true_or_false): Ditto. (gori_compute::outgoing_edge_range_p): Cast result to the correct type if necessary. (logical_stmt_cache::cacheable_p): Use range_compatible_p. * gimple-range.cc (gimple_ranger::calc_stmt): Check range_compatible_p before casting the range. (gimple_ranger::range_on_exit): Use range_compatible_p. (gimple_ranger::range_on_edge): Ditto. gcc/testsuite/ * gcc.dg/pr97360-2.c: New test.
2020-10-07Rename -fevrp-mode= to --param=evrp-mode=.Aldy Hernandez1-1/+1
* common.opt (-fevrp-mode): Rename and move... * params.opt (--param=evrp-mode): ...here. * gimple-range.h (DEBUG_RANGE_CACHE): Use param_evrp_mode instead of flag_evrp_mode. * gimple-ssa-evrp.c (rvrp_folder): Same. (hybrid_folder): Same. (execute_early_vrp): Same.
2020-10-06Ranger classes.Andrew MacLeod1-0/+170
Add the 8 ranger files and the Makefile changes to build it. 2020-10-06 Andrew MacLeod <amacleod@redhat.com> * Makefile.in (OBJS): Add gimple-range*.o. * gimple-range.h: New file. * gimple-range.cc: New file. * gimple-range-cache.h: New file. * gimple-range-cache.cc: New file. * gimple-range-edge.h: New file. * gimple-range-edge.cc: New file. * gimple-range-gori.h: New file. * gimple-range-gori.cc: New file.