Skip to content

Commit 7be7e02

Browse files
weiyu-chensys_zuul
authored and
sys_zuul
committed
Avoid splitting RetVal variable into two.
Change-Id: Ie29d2ec9c10dd03475db15013eac5c7569a3e4b5
1 parent 049782d commit 7be7e02

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

visa/Optimizer.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10674,7 +10674,7 @@ enum SplitBounds : unsigned {
1067410674
HiRBound = 127
1067510675
};
1067610676

10677-
bool isCandidateDecl(G4_Declare *Dcl)
10677+
static bool isCandidateDecl(G4_Declare *Dcl, const IR_Builder& builder)
1067810678
{
1067910679
G4_Declare *RootDcl = Dcl->getRootDeclare();
1068010680
if (RootDcl->getRegFile() != G4_GRF)
@@ -10688,6 +10688,13 @@ bool isCandidateDecl(G4_Declare *Dcl)
1068810688
if (RootDcl->getAddressed())
1068910689
return false;
1069010690

10691+
if (builder.isPreDefArg(RootDcl) || builder.isPreDefRet(RootDcl))
10692+
{
10693+
return false;
10694+
}
10695+
10696+
// ToDo: add more special declares to exclude list
10697+
1069110698
return true;
1069210699
}
1069310700

@@ -10791,7 +10798,7 @@ void Optimizer::splitVariables()
1079110798
fg.globalOpndHT.isOpndGlobal(Dst))
1079210799
continue;
1079310800
auto Dcl = Dst->getTopDcl();
10794-
if (!Dcl || !isCandidateDecl(Dcl))
10801+
if (!Dcl || !isCandidateDecl(Dcl, builder))
1079510802
continue;
1079610803

1079710804
unsigned LBound = Dst->getLeftBound();
@@ -10942,7 +10949,7 @@ void Optimizer::split4GRFVars()
1094210949
{
1094310950
if (dcl->getAliasDeclare() == nullptr)
1094410951
{
10945-
if (isCandidateDecl(dcl))
10952+
if (isCandidateDecl(dcl, builder))
1094610953
{
1094710954
if (varToSplit.find(dcl) == varToSplit.end())
1094810955
{
@@ -10960,7 +10967,7 @@ void Optimizer::split4GRFVars()
1096010967
// must appear before its alias decls
1096110968
uint32_t offset = 0;
1096210969
G4_Declare* rootDcl = dcl->getRootDeclare(offset);
10963-
if (offset != 0 && isCandidateDecl(rootDcl))
10970+
if (offset != 0 && isCandidateDecl(rootDcl, builder))
1096410971
{
1096510972
varToSplit.erase(rootDcl);
1096610973
}

0 commit comments

Comments
 (0)