Skip to content

Commit

Permalink
find_base_value part
Browse files Browse the repository at this point in the history
The following adjusts find_base_value similar as to what
find_base_term was adjusted for PR113255.

	* alias.cc (known_base_value_p): Remove.
	(find_base_value): Remove PLUS/MINUS handling
	when both operands are not CONST_INT_P.
  • Loading branch information
rguenth authored and ouuleilei-bot committed Jan 15, 2024
1 parent b029251 commit e6f2dfe
Showing 1 changed file with 4 additions and 58 deletions.
62 changes: 4 additions & 58 deletions gcc/alias.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1398,26 +1398,6 @@ unique_base_value_p (rtx x)
return GET_CODE (x) == ADDRESS && GET_MODE (x) == Pmode;
}

/* Return true if X is known to be a base value. */

static bool
known_base_value_p (rtx x)
{
switch (GET_CODE (x))
{
case LABEL_REF:
case SYMBOL_REF:
return true;

case ADDRESS:
/* Arguments may or may not be bases; we don't know for sure. */
return GET_MODE (x) != VOIDmode;

default:
return false;
}
}

/* Inside SRC, the source of a SET, find a base address. */

static rtx
Expand Down Expand Up @@ -1488,46 +1468,12 @@ find_base_value (rtx src)
case PLUS:
case MINUS:
{
rtx temp, src_0 = XEXP (src, 0), src_1 = XEXP (src, 1);

/* If either operand is a REG that is a known pointer, then it
is the base. */
if (REG_P (src_0) && REG_POINTER (src_0))
return find_base_value (src_0);
if (REG_P (src_1) && REG_POINTER (src_1))
return find_base_value (src_1);

/* If either operand is a REG, then see if we already have
a known value for it. */
if (REG_P (src_0))
{
temp = find_base_value (src_0);
if (temp != 0)
src_0 = temp;
}

if (REG_P (src_1))
{
temp = find_base_value (src_1);
if (temp!= 0)
src_1 = temp;
}

/* If either base is named object or a special address
(like an argument or stack reference), then use it for the
base term. */
if (src_0 != 0 && known_base_value_p (src_0))
return src_0;

if (src_1 != 0 && known_base_value_p (src_1))
return src_1;
rtx src_0 = XEXP (src, 0), src_1 = XEXP (src, 1);

/* Guess which operand is the base address:
If either operand is a symbol, then it is the base. If
either operand is a CONST_INT, then the other is the base. */
if (CONST_INT_P (src_1) || CONSTANT_P (src_0))
/* If either operand is a CONST_INT, then the other is the base. */
if (CONST_INT_P (src_1))
return find_base_value (src_0);
else if (CONST_INT_P (src_0) || CONSTANT_P (src_1))
else if (CONST_INT_P (src_0))
return find_base_value (src_1);

return 0;
Expand Down

0 comments on commit e6f2dfe

Please sign in to comment.