From: Marc Glisse Date: Thu, 23 Nov 2017 19:53:09 +0000 (+0100) Subject: Simplify ptr - 0 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d43177addfb5f32bca4845af930bb67104f1845f;p=gcc.git Simplify ptr - 0 2017-11-23 Marc Glisse * match.pd (ptr-0): New transformation. From-SVN: r255113 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 704d4e22c93..be8dbe492d1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2017-11-23 Marc Glisse + + * match.pd (ptr-0): New transformation. + 2017-11-23 Charles Baylis * config/arm/arm-protos.h (enum arm_addr_mode_op): New. diff --git a/gcc/match.pd b/gcc/match.pd index 0949a9bcd2c..84db1ee7360 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -102,6 +102,11 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (pointer_plus integer_zerop @1) (non_lvalue (convert @1))) +/* ptr - 0 -> (type)ptr */ +(simplify + (pointer_diff @0 integer_zerop) + (convert @0)) + /* See if ARG1 is zero and X + ARG1 reduces to X. Likewise if the operands are reversed. */ (simplify