mirror of git://gcc.gnu.org/git/gcc.git
				
				
				
			[PATCH]Fix PR66556.
[PATCH]Fix PR66556. Don't drop side-effect in simplify_const_relational_operation function. gcc/ 2015-07-13 Renlin Li <renlin.li@arm.com> PR rtl/66556 * simplify-rtx.c (simplify_const_relational_operation): Add side_effects_p checks. gcc/testsuite/ 2015-07-13 Renlin Li <renlin.li@arm.com> PR rtl/66556 * gcc.c-torture/execute/pr66556.c: New. From-SVN: r225729
This commit is contained in:
		
							parent
							
								
									76d96a5a6f
								
							
						
					
					
						commit
						2d87c1d472
					
				|  | @ -1,3 +1,9 @@ | ||||||
|  | 2015-07-13  Renlin Li  <renlin.li@arm.com> | ||||||
|  | 
 | ||||||
|  | 	PR rtl/66556 | ||||||
|  | 	* simplify-rtx.c (simplify_const_relational_operation): Add | ||||||
|  | 	side_effects_p checks. | ||||||
|  | 
 | ||||||
| 2015-07-12  Aldy Hernandez  <aldyh@redhat.com> | 2015-07-12  Aldy Hernandez  <aldyh@redhat.com> | ||||||
| 
 | 
 | ||||||
| 	* bitmap.h: Fix double word typos. | 	* bitmap.h: Fix double word typos. | ||||||
|  |  | ||||||
|  | @ -4925,7 +4925,8 @@ simplify_const_relational_operation (enum rtx_code code, | ||||||
| 
 | 
 | ||||||
|   /* Optimize comparisons with upper and lower bounds.  */ |   /* Optimize comparisons with upper and lower bounds.  */ | ||||||
|   if (HWI_COMPUTABLE_MODE_P (mode) |   if (HWI_COMPUTABLE_MODE_P (mode) | ||||||
|       && CONST_INT_P (trueop1)) |       && CONST_INT_P (trueop1) | ||||||
|  |       && !side_effects_p (trueop0)) | ||||||
|     { |     { | ||||||
|       int sign; |       int sign; | ||||||
|       unsigned HOST_WIDE_INT nonzero = nonzero_bits (trueop0, mode); |       unsigned HOST_WIDE_INT nonzero = nonzero_bits (trueop0, mode); | ||||||
|  | @ -5038,7 +5039,7 @@ simplify_const_relational_operation (enum rtx_code code, | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|   /* Optimize integer comparisons with zero.  */ |   /* Optimize integer comparisons with zero.  */ | ||||||
|   if (trueop1 == const0_rtx) |   if (trueop1 == const0_rtx && !side_effects_p (trueop0)) | ||||||
|     { |     { | ||||||
|       /* Some addresses are known to be nonzero.  We don't know
 |       /* Some addresses are known to be nonzero.  We don't know
 | ||||||
| 	 their sign, but equality comparisons are known.  */ | 	 their sign, but equality comparisons are known.  */ | ||||||
|  | @ -5089,7 +5090,7 @@ simplify_const_relational_operation (enum rtx_code code, | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|   /* Optimize comparison of ABS with zero.  */ |   /* Optimize comparison of ABS with zero.  */ | ||||||
|   if (trueop1 == CONST0_RTX (mode) |   if (trueop1 == CONST0_RTX (mode) && !side_effects_p (trueop0) | ||||||
|       && (GET_CODE (trueop0) == ABS |       && (GET_CODE (trueop0) == ABS | ||||||
| 	  || (GET_CODE (trueop0) == FLOAT_EXTEND | 	  || (GET_CODE (trueop0) == FLOAT_EXTEND | ||||||
| 	      && GET_CODE (XEXP (trueop0, 0)) == ABS))) | 	      && GET_CODE (XEXP (trueop0, 0)) == ABS))) | ||||||
|  |  | ||||||
|  | @ -1,3 +1,8 @@ | ||||||
|  | 2015-07-13  Renlin Li  <renlin.li@arm.com> | ||||||
|  | 
 | ||||||
|  | 	PR rtl/66556 | ||||||
|  | 	* gcc.c-torture/execute/pr66556.c: New. | ||||||
|  | 
 | ||||||
| 2015-07-12  Aldy Hernandez  <aldyh@redhat.com> | 2015-07-12  Aldy Hernandez  <aldyh@redhat.com> | ||||||
| 
 | 
 | ||||||
| 	* gcc.dg/20020219-1.c: Fix double word typos. | 	* gcc.dg/20020219-1.c: Fix double word typos. | ||||||
|  |  | ||||||
|  | @ -0,0 +1,52 @@ | ||||||
|  | /* { dg-do run } */ | ||||||
|  | 
 | ||||||
|  | extern void abort (void); | ||||||
|  | 
 | ||||||
|  | struct { | ||||||
|  |   unsigned f2; | ||||||
|  |   unsigned f3 : 15; | ||||||
|  |   unsigned f5 : 3; | ||||||
|  |   short f6; | ||||||
|  | } b = {0x7f8000, 6, 5, 0}, g = {8, 0, 5, 0}; | ||||||
|  | 
 | ||||||
|  | short d, l; | ||||||
|  | int a, c, h = 8; | ||||||
|  | volatile char e[237] = {4}; | ||||||
|  | short *f = &d; | ||||||
|  | short i[5] = {3}; | ||||||
|  | char j; | ||||||
|  | int *k = &c; | ||||||
|  | 
 | ||||||
|  | int | ||||||
|  | fn1 (unsigned p1) { return -p1; } | ||||||
|  | 
 | ||||||
|  | void | ||||||
|  | fn2 (char p1) | ||||||
|  | { | ||||||
|  |   a = p1; | ||||||
|  |   e[0]; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | short | ||||||
|  | fn3 () | ||||||
|  | { | ||||||
|  |   *k = 4; | ||||||
|  |   return *f; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | int | ||||||
|  | main () | ||||||
|  | { | ||||||
|  | 
 | ||||||
|  |   unsigned m; | ||||||
|  |   short *n = &i[4]; | ||||||
|  | 
 | ||||||
|  |   m = fn1 ((h && j) <= b.f5); | ||||||
|  |   l = m > g.f3; | ||||||
|  |   *n = 3; | ||||||
|  |   fn2 (b.f2 >> 15); | ||||||
|  |   if ((a & 0xff) != 0xff) | ||||||
|  |     abort (); | ||||||
|  | 
 | ||||||
|  |   return 0; | ||||||
|  | } | ||||||
		Loading…
	
		Reference in New Issue
	
	 Renlin Li
						Renlin Li