Check for undefined before not returning a constant value
authorAndrew MacLeod <amacleod@redhat.com>
Wed, 21 Oct 2020 23:55:28 +0000 (19:55 -0400)
committerAndrew MacLeod <amacleod@redhat.com>
Thu, 22 Oct 2020 00:02:22 +0000 (20:02 -0400)
commitca5f4666f7a9404cdb04832324de3dd7d71e35c3
tree1009d2a11e595ce97796371bcab61744f85f7581
parent2ab1fc7a322e2582772f0e4ed916508c890175e3
Check for undefined before not returning a constant value

Don't return UNDEFINED for a range in an unreachable block if the global
value evaluates to a constant.  Return that constant instead.

PR tree-optimization/97515
* value-query.cc (range_query::value_of_expr): If the result is
UNDEFINED, check to see if the global value is a constant.
(range_query::value_on_edge): Ditto.
gcc/testsuite/gcc.dg/pr97515.c [new file with mode: 0644]
gcc/value-query.cc