poly_int: adjust_ptr_info_misalignment
authorRichard Sandiford <richard.sandiford@linaro.org>
Thu, 21 Dec 2017 07:01:59 +0000 (07:01 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Thu, 21 Dec 2017 07:01:59 +0000 (07:01 +0000)
This patch makes adjust_ptr_info_misalignment take the adjustment
as a poly_uint64 rather than an unsigned int.

2017-12-21  Richard Sandiford  <richard.sandiford@linaro.org>
    Alan Hayward  <alan.hayward@arm.com>
    David Sherwood  <david.sherwood@arm.com>

gcc/
* tree-ssanames.h (adjust_ptr_info_misalignment): Take the increment
as a poly_uint64 rather than an unsigned int.
* tree-ssanames.c (adjust_ptr_info_misalignment): Likewise.

Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r255928

gcc/ChangeLog
gcc/tree-ssanames.c
gcc/tree-ssanames.h

index 26b35ab7c71f3fe149adc12b327428f6f4fa0f26..08052356f09b5c128bf1f3d3f3467bc146b6299b 100644 (file)
@@ -1,3 +1,11 @@
+2017-12-21  Richard Sandiford  <richard.sandiford@linaro.org>
+           Alan Hayward  <alan.hayward@arm.com>
+           David Sherwood  <david.sherwood@arm.com>
+
+       * tree-ssanames.h (adjust_ptr_info_misalignment): Take the increment
+       as a poly_uint64 rather than an unsigned int.
+       * tree-ssanames.c (adjust_ptr_info_misalignment): Likewise.
+
 2017-12-21  Richard Sandiford  <richard.sandiford@linaro.org>
            Alan Hayward  <alan.hayward@arm.com>
            David Sherwood  <david.sherwood@arm.com>
index d00d64852c2eecf3435be00d2f18fdd85941ee2a..2fe6e3f1362f8e14190a50717f3c5f34177b3896 100644 (file)
@@ -643,13 +643,16 @@ set_ptr_info_alignment (struct ptr_info_def *pi, unsigned int align,
    misalignment by INCREMENT modulo its current alignment.  */
 
 void
-adjust_ptr_info_misalignment (struct ptr_info_def *pi,
-                             unsigned int increment)
+adjust_ptr_info_misalignment (struct ptr_info_def *pi, poly_uint64 increment)
 {
   if (pi->align != 0)
     {
-      pi->misalign += increment;
-      pi->misalign &= (pi->align - 1);
+      increment += pi->misalign;
+      if (!known_misalignment (increment, pi->align, &pi->misalign))
+       {
+         pi->align = known_alignment (increment);
+         pi->misalign = 0;
+       }
     }
 }
 
index f7e032fe11d2ebb9e66a70c631fc0e617de00b44..ea62a0b84d572e14f1ff61589dd65176e93e0e41 100644 (file)
@@ -89,8 +89,7 @@ extern bool get_ptr_info_alignment (struct ptr_info_def *, unsigned int *,
 extern void mark_ptr_info_alignment_unknown (struct ptr_info_def *);
 extern void set_ptr_info_alignment (struct ptr_info_def *, unsigned int,
                                    unsigned int);
-extern void adjust_ptr_info_misalignment (struct ptr_info_def *,
-                                         unsigned int);
+extern void adjust_ptr_info_misalignment (struct ptr_info_def *, poly_uint64);
 extern struct ptr_info_def *get_ptr_info (tree);
 extern void set_ptr_nonnull (tree);
 extern bool get_ptr_nonnull (const_tree);