[Ada] Compile-time evaluation of predicate checks
This patch recognizes case of dynamic predicates on integer subtypes
that are simple enough to be evaluated statically when the argument is
itself a literal. Even though in many cases such predicate checks will
be removed by the back-end with any level of optimization, it is
preferable to perform this constant folding in the front-end, wich also
cleans up the output of CCG, as well as producing explicit warnings when
the test will fail.
2019-07-11 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* exp_ch6.adb (Can_Fold_Predicate_Call): New function,
subsidiary of Expand_Call_Helper, to compute statically a
predicate check when the argument is a static integer.
gcc/testsuite/
* gnat.dg/predicate11.adb: New testcase.
From-SVN: r273386