Commit a2cd028f by Janis Johnson Committed by Janis Johnson

loop.c (remove_constant_addition): Avoid clobbering a shared CONST expression.

	* loop.c (remove_constant_addition): Avoid clobbering a shared
	CONST expression.

Co-Authored-By: Jan Hubicka <jh@suse.cz>

From-SVN: r49556
parent 199ecb18
2002-02-06 Janis Johnson <janis187@us.ibm.com>
Jan Hubicka <jh@suse.cz>
* loop.c (remove_constant_addition): Avoid clobbering a shared
CONST expression.
2002-02-06 Ulrich Weigand <uweigand@de.ibm.com> 2002-02-06 Ulrich Weigand <uweigand@de.ibm.com>
* config.gcc (s390x-*-linux*): Add t-linux64 makefile fragment. * config.gcc (s390x-*-linux*): Add t-linux64 makefile fragment.
......
...@@ -3683,8 +3683,19 @@ remove_constant_addition (x) ...@@ -3683,8 +3683,19 @@ remove_constant_addition (x)
HOST_WIDE_INT addval = 0; HOST_WIDE_INT addval = 0;
rtx exp = *x; rtx exp = *x;
/* Avoid clobbering a shared CONST expression. */
if (GET_CODE (exp) == CONST) if (GET_CODE (exp) == CONST)
exp = XEXP (exp, 0); {
if (GET_CODE (XEXP (exp, 0)) == PLUS
&& GET_CODE (XEXP (XEXP (exp, 0), 0)) == SYMBOL_REF
&& GET_CODE (XEXP (XEXP (exp, 0), 1)) == CONST_INT)
{
*x = XEXP (XEXP (exp, 0), 0);
return INTVAL (XEXP (XEXP (exp, 0), 1));
}
return 0;
}
if (GET_CODE (exp) == CONST_INT) if (GET_CODE (exp) == CONST_INT)
{ {
addval = INTVAL (exp); addval = INTVAL (exp);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment