diff mbox series

[054/nnn] poly_int: adjust_ptr_info_misalignment

Message ID 87efptlqxk.fsf@linaro.org
State New
Headers show
Series [054/nnn] poly_int: adjust_ptr_info_misalignment | expand

Commit Message

Richard Sandiford Oct. 23, 2017, 5:22 p.m. UTC
This patch makes adjust_ptr_info_misalignment take the adjustment
as a poly_uint64 rather than an unsigned int.


2017-10-23  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.

Comments

Jeff Law Nov. 28, 2017, 4:51 p.m. UTC | #1
On 10/23/2017 11:22 AM, Richard Sandiford wrote:
> This patch makes adjust_ptr_info_misalignment take the adjustment

> as a poly_uint64 rather than an unsigned int.

> 

> 

> 2017-10-23  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.

> 

OK.
jeff
diff mbox series

Patch

Index: gcc/tree-ssanames.h
===================================================================
--- gcc/tree-ssanames.h	2017-10-23 17:22:13.147805567 +0100
+++ gcc/tree-ssanames.h	2017-10-23 17:22:15.674312500 +0100
@@ -89,8 +89,7 @@  extern bool get_ptr_info_alignment (stru
 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);
Index: gcc/tree-ssanames.c
===================================================================
--- gcc/tree-ssanames.c	2017-10-23 17:22:13.147805567 +0100
+++ gcc/tree-ssanames.c	2017-10-23 17:22:15.674312500 +0100
@@ -643,13 +643,16 @@  set_ptr_info_alignment (struct ptr_info_
    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;
+	}
     }
 }