Use GORI to evaluate arguments of a COND_EXPR.
authorAndrew MacLeod <amacleod@redhat.com>
Tue, 15 Feb 2022 00:43:40 +0000 (19:43 -0500)
committerAndrew MacLeod <amacleod@redhat.com>
Tue, 15 Feb 2022 22:03:27 +0000 (17:03 -0500)
commite15425e899e4a9eec768cf74aaf36cdbf1d29913
tree19d92086586f3e8f60f478030c89710f2a6f41e9
parent84832cab6e43db7fa10ec53d15f8f8457aa31080
Use GORI to evaluate arguments of a COND_EXPR.

Provide an API into gori to perform a basic evaluation of the arguments of a
COND_EXPR if they are in the dependency chain of the condition.

PR tree-optimization/104526
gcc/
* gimple-range-fold.cc (fold_using_range::range_of_cond_expr): Call
new routine.
* gimple-range-gori.cc (range_def_chain::get_def_chain): Force a build
of dependency chain if there isn't one.
(gori_compute::condexpr_adjust): New.
* gimple-range-gori.h (class gori_compute): New prototype.

gcc/testsuite/
* gcc.dg/pr104526.c: New.
gcc/gimple-range-fold.cc
gcc/gimple-range-gori.cc
gcc/gimple-range-gori.h
gcc/testsuite/gcc.dg/pr104526.c [new file with mode: 0644]