[Ada] Remove redundant predicate checks
commit6ef13c4ff90e51d13162fd8328d873ae03e6b2b4
authorEd Schonberg <schonberg@adacore.com>
Thu, 11 Jul 2019 08:02:35 +0000 (11 08:02 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Thu, 11 Jul 2019 08:02:35 +0000 (11 08:02 +0000)
tree33d3ab5a650516467f4c7d02b8bde04513d0c8cd
parent220dc4b2825745db538915298d0c79f2f12ce5e0
[Ada] Remove redundant predicate checks

This patch removes redundant dynamic predicate checks generated by type
conversions in various contexts. The patch also recognizes additional
such checks that can be evaluated statically when applied to constant
values.

No simple test available.

2019-07-11  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

* exp_ch4.adb (Expand_N_Type_Conversion): If a predicate check
is generated, analyze it with range check suppressed, because
that check has been previously applied.
* exp_ch5.adb (Expand_N_Assignment_Statement): If the RHS is a
type conversion to the type of the LHS, do not apply a predicate
check to the RHS because it will have been generated already
during its expansion.
* exp_ch6.adb (Can_Fold_Predicate_Call): Extend processing to
handle a predicate check on a constant entity whose value is
static.

From-SVN: r273395
gcc/ada/ChangeLog
gcc/ada/exp_ch4.adb
gcc/ada/exp_ch5.adb
gcc/ada/exp_ch6.adb