re PR middle-end/85974 (Failure to optimize difference of two pointers into a compile...
authorRichard Biener <rguenther@suse.de>
Fri, 13 Jul 2018 11:25:38 +0000 (11:25 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 13 Jul 2018 11:25:38 +0000 (11:25 +0000)
2018-07-13  Richard Biener  <rguenther@suse.de>

PR middle-end/85974
* match.pd (addr1 - addr2): Allow either of the operand to
have a conversion.

* gcc.c-torture/compile/930326-1.c: Adjust to cover widening.

From-SVN: r262632

gcc/ChangeLog
gcc/match.pd
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/930326-1.c

index 3f70e46d19333fcd0a833953fb08453e9ee70bb8..2ca3333161cf167275e994d29ebc0dad1428ae8f 100644 (file)
@@ -1,3 +1,9 @@
+2018-07-13  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/85974
+       * match.pd (addr1 - addr2): Allow either of the operand to
+       have a conversion.
+
 2018-07-13  Tom de Vries  <tdevries@suse.de>
 
        * tree-inline.c (remap_ssa_name): Save and reuse debug exprs generated
index 1a8ad4465858dec02d729e00b8c0900d735262a9..730bbabb593f18edae7fa6263475a3ca582ed339 100644 (file)
@@ -1673,14 +1673,14 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
    (if (ptr_difference_const (@0, @1, &diff))
     { build_int_cst_type (type, diff); }))))
 (simplify
- (pointer_diff (convert?@2 ADDR_EXPR@0) (convert?@3 @1))
+ (pointer_diff (convert?@2 ADDR_EXPR@0) (convert1?@3 @1))
  (if (tree_nop_conversion_p (TREE_TYPE(@2), TREE_TYPE (@0))
       && tree_nop_conversion_p (TREE_TYPE(@3), TREE_TYPE (@1)))
   (with { poly_int64 diff; }
    (if (ptr_difference_const (@0, @1, &diff))
     { build_int_cst_type (type, diff); }))))
 (simplify
- (pointer_diff (convert?@2 @0) (convert?@3 ADDR_EXPR@1))
+ (pointer_diff (convert?@2 @0) (convert1?@3 ADDR_EXPR@1))
  (if (tree_nop_conversion_p (TREE_TYPE(@2), TREE_TYPE (@0))
       && tree_nop_conversion_p (TREE_TYPE(@3), TREE_TYPE (@1)))
   (with { poly_int64 diff; }
index 0dcc3b468585bb8080c20868c2fa4e8fa8241c1c..7b9627f0b9594ceda5f624854372f335a41d3266 100644 (file)
@@ -1,3 +1,8 @@
+2018-07-13  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/85974
+       * gcc.c-torture/compile/930326-1.c: Adjust to cover widening.
+
 2018-07-13  Tom de Vries  <tdevries@suse.de>
 
        * gcc.dg/guality/clztest.c: Add -fno-ipa-icf in dg-options.
index 97313d86aa971ddcfc869fb05644867578f89fec..74f4ef6363755c8867f7b7e1f793ee471a8fdc9d 100644 (file)
@@ -4,3 +4,4 @@ struct
 } s;
 
 long i = s.f-&s.b;
+long long j = s.f-&s.b;