Skip to content

Commit d7be88d

Browse files
weiyu-chengfxbot
authored andcommitted
Enable copy propagation for mad src2 scalars
Change-Id: Ibc2f95b210649d8516c95f7c3bb3123dfc84819a
1 parent 9b2ef77 commit d7be88d

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

visa/Gen4_IR.cpp

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1860,7 +1860,6 @@ bool G4_INST::canPropagateTo(G4_INST *useInst, Gen4_Operand_Number opndNum, MovT
18601860
return false;
18611861
};
18621862

1863-
18641863
// mov (16|M0) r47.0 1:w
18651864
// (W) add (16|M0) r49.0 r47.0 r45.0
18661865
//
@@ -1969,18 +1968,9 @@ bool G4_INST::canPropagateTo(G4_INST *useInst, Gen4_Operand_Number opndNum, MovT
19691968
return false;
19701969
}
19711970

1972-
unsigned numDef = 0;
1973-
for (DEF_EDGE_LIST_ITER DI = useInst->defInstList.begin(),
1974-
DE = useInst->defInstList.end(); DI != DE; ++DI)
1971+
if (useInst->getSingleDef(opndNum) == nullptr)
19751972
{
1976-
if (DI->second == opndNum)
1977-
{
1978-
numDef++;
1979-
if (numDef > 1)
1980-
{
1981-
return false;
1982-
}
1983-
}
1973+
return false;
19841974
}
19851975

19861976
// Cannot generally safely propagate replicated vectors.
@@ -2000,9 +1990,12 @@ bool G4_INST::canPropagateTo(G4_INST *useInst, Gen4_Operand_Number opndNum, MovT
20001990

20011991
// Skip propagate scalar copies into the additive operand (src2) of integer
20021992
// pseudo mad.
2003-
if (opndNum == Opnd_src2 && useInst->opcode() == G4_pseudo_mad &&
2004-
IS_TYPE_INT(useType) && rd && rd->isScalar())
2005-
return false;
1993+
if (!builder.hasAlign1Ternary())
1994+
{
1995+
if (opndNum == Opnd_src2 && useInst->opcode() == G4_pseudo_mad &&
1996+
IS_TYPE_INT(useType) && rd && rd->isScalar())
1997+
return false;
1998+
}
20061999

20072000
// Check repeat region
20082001
bool sameDefUseELSize = (dstElSize == useElSize);

0 commit comments

Comments
 (0)