This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[cfg-branch] fix conflict graph construcdtion
- From: Jan Hubicka <jh at suse dot cz>
- To: gcc-patches at gcc dot gnu dot org, gcc-pdo at atrey dot karlin dot mff dot cuni dot cz
- Date: Thu, 21 Feb 2002 19:54:10 +0100
- Subject: [cfg-branch] fix conflict graph construcdtion
Thu Feb 21 22:05:13 CET 2002 Jan Hubicka <jh@suse.cz>
* (mark_conflict): Skip reg-reg copies.
*** coalesce.c.old Thu Feb 21 19:48:38 2002
--- coalesce.c Thu Feb 21 19:48:46 2002
*************** struct mark_conflict_data
*** 44,57 ****
/* Mark conflict betwen X and live registers. */
static void
! mark_conflict (x, setter, data)
rtx x;
! rtx setter ATTRIBUTE_UNUSED;
void *data;
{
struct mark_conflict_data *d = (struct mark_conflict_data *)data;
regset live = d->live;
cgraph graph = (cgraph) d->graph;
if (GET_CODE (x) == SUBREG)
x = SUBREG_REG (x);
--- 44,66 ----
/* Mark conflict betwen X and live registers. */
static void
! mark_conflict (x, set, data)
rtx x;
! rtx set;
void *data;
{
struct mark_conflict_data *d = (struct mark_conflict_data *)data;
regset live = d->live;
cgraph graph = (cgraph) d->graph;
+ int skip = -1;
+
+ /* In the case of reg-reg copy, we may safely omit the conflict
+ between source and destination and coalesce both operands into
+ single register. */
+ if (GET_CODE (set) == SET
+ && REG_P (XEXP (set, 0))
+ && REG_P (XEXP (set, 1)))
+ skip = REGNO (SET_SRC (set));
if (GET_CODE (x) == SUBREG)
x = SUBREG_REG (x);
*************** mark_conflict (x, setter, data)
*** 60,67 ****
int regno = REGNO (x);
int regno2;
EXECUTE_IF_SET_IN_BITMAP (live, 0, regno2,
! SET_BIT (graph[regno], regno2);
! SET_BIT (graph[regno2], regno););
}
}
--- 69,79 ----
int regno = REGNO (x);
int regno2;
EXECUTE_IF_SET_IN_BITMAP (live, 0, regno2,
! if (regno2 != skip)
! {
! SET_BIT (graph[regno], regno2);
! SET_BIT (graph[regno2], regno);
! });
}
}