From 2fb16ac8620164c789791acb5d1d56a868100370 Mon Sep 17 00:00:00 2001 From: sandeep Date: Wed, 23 Feb 2000 19:11:09 +0000 Subject: [PATCH] aliasing for unions bug. git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@120 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- src/SDCCcse.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/SDCCcse.c b/src/SDCCcse.c index 8df03bae..0a292770 100644 --- a/src/SDCCcse.c +++ b/src/SDCCcse.c @@ -276,11 +276,14 @@ DEFSETFUNC(findPointerSet) cseDef *cdp = item; V_ARG(operand *,op); V_ARG(operand **,opp); + V_ARG(operand *,rop); if (POINTER_SET(cdp->diCode) && IC_RESULT(cdp->diCode)->key == op->key && !isOperandVolatile(IC_RESULT(cdp->diCode),TRUE) && - !isOperandVolatile(IC_RIGHT(cdp->diCode),TRUE)) { + !isOperandVolatile(IC_RIGHT(cdp->diCode),TRUE) && + getSize(operandType(IC_RESULT(cdp->diCode))) == + getSize(operandType(rop))) { *opp = IC_RIGHT(cdp->diCode); return 1; } @@ -1224,7 +1227,7 @@ int cseBBlock ( eBBlock *ebb, int computeOnly, for the same pointer visible if yes then change this into an assignment */ pdop = NULL; - if (applyToSetFTrue(cseSet,findPointerSet,IC_LEFT(ic),&pdop) && + if (applyToSetFTrue(cseSet,findPointerSet,IC_LEFT(ic),&pdop,IC_RESULT(ic)) && !bitVectBitValue(ebb->ptrsSet,pdop->key)){ ic->op = '='; IC_LEFT(ic) = NULL; @@ -1351,7 +1354,7 @@ int cseBBlock ( eBBlock *ebb, int computeOnly, !(IS_BITFIELD(OP_SYMBOL(IC_RESULT(ic))->etype) || isOperandVolatile(IC_LEFT(ic),TRUE))) { pdop = NULL; - applyToSet(ptrSetSet,findPointerSet,IC_LEFT(ic),&pdop); + applyToSet(ptrSetSet,findPointerSet,IC_LEFT(ic),&pdop,IC_RESULT(ic)); /* if we find it then locally replace all references to the result with what we assigned */ if (pdop) { -- 2.47.2